我在网上搜索了这个问题的答案,但没有运气。
我想知道是否可以构建某些类和/或 .cs 文件来分离同一项目中的程序集?
即,我在一个项目中有多个 HttpHandler,目前我正在将它们全部构建到一个程序集 HttpHandler 中,但我在想如果以后我想更改其中一个处理程序中的代码,我将需要重建整个程序集,并且即使我没有更改代码,也可能会给其他处理程序带来问题。我认为最好让它们保持自治,这样对一个处理程序的更新绝不会影响其他处理程序。当然,我可以创建单独的项目,但我想知道是否可以在同一个项目中执行此操作。
我用的是VS2008专业版。
谢谢!
I've searched online for the answer to this but with no luck.
I was wondering if it was possible to build certain classes and or .cs files to separate assemblies within the same project?
I.e I have a number of HttpHandlers in one project, currently I am building them all into one assembly HttpHandlers, but what I was thinking if later I wanted to change the code in one of the Handlers I would need to rebuild the whole assembly, and possibly introduce problems with the other Handlers even though I haven't changed the code. I thought it would be best to keep them autonomous so an update to one handler would in no way affect the others. Ofcourse I could create separate projects but I was wondering if it was possible to do this within the same project.
I'm using VS2008 Pro.
Thanks!
发布评论
评论(2)
也许您可以使用 多文件程序集< /a>.但这是一项繁重的工作。
May be you can do that with Multi-file Assemblies. But it's a lot of work.
编辑:我不小心发布了错误的问题(打开了多个选项卡 - 我的错)。该解决方案针对相反的问题:如何将多个程序集合并为一个 .exe。
我今天研究了同样的问题,发现 ILMerge。
我有一个简单的 WinForms 应用程序,只是想快速查看一些内容。
以下是我在主项目 bin\Debug 目录中运行的内容:
“/targetplatform”开关用于修复 ILMerge 抛出“不允许未解析的程序集引用:System.Core”异常的问题。
我的项目是用 v4.5 编译的 - 为您的项目调整它。
其他人建议通过创建 ILMerge.exe.config 文件来解决该问题。
它肯定会使命令行更短:-)
EDIT: I accidentally posted to the wrong question (multiple tabs opened - my bad). This solution is for the opposite problem: how to merge multiple assemblies into one single .exe.
I looked into the same issue today and found ILMerge from MS Research.
I had a simple WinForms app and just wanted to see something quickly.
Here is what I ran in my main projects bin\Debug directory:
The "/targetplatform" switch is to fix an issue with ILMerge throwing an "Unresolved assembly reference not allowed: System.Core" exception.
My project was compiled with v4.5 - adjust this for your project.
Other people have suggested fixing the issue by creating an ILMerge.exe.config file.
It will certainly make the command-line shorter :-)