开发者

Compiling .NET code into one EXE and the other namespaces into DLLs

I have written a windows service. The windows service has it's own namespace, obviously. I have 3 other namespaces that I have written that have their respective classes.

When I debug and build the solution it compiles all of the namespaces into the executable file. Is there a way in Visual Studio to explicitly have namespaces get compiled into separate DLLs? 开发者_开发问答 And just have the main startup namespace in the EXE?

Thanks in advance!


It sounds like you've just got one project. Just create two or more projects - one Windows Service project and one or more class library projects. Put the code for the service in its project, and the rest in the class library project or projects. It's up to you whether you create one assembly per namespace or lump all the other code into one class library.


Namespaces and projects are unrelated as far as the compiler is concerned. That assembly names correspond to namespaces is purely a convention and quite often not followed.

In .net one executable is one assembly and usually one project. So if you want want dlls create a "Class Library" project for them and put the corresponding source code in them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜