开发者

Build separate assemblies within same project Visual Studio.NET

开发者 https://www.devze.com 2023-01-13 20:45 出处:网络
I\'ve searched onli开发者_如何学Gone 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 proje

I've searched onli开发者_如何学Gone 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!


May be you can do that with Multi-file Assemblies. But it's a lot of work.


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:

"C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe"
  /targetplatform:v4,"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"
  /target:winexe /wildcards /out:TheNewMerged.exe TheOld.exe *.dll

copy TheOld.exe.config TheNewMerged.exe.config

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 :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消