Making a C# project DLL and EXE
I'm working on a project where I need to have both an executable so that the user can run a configuration int开发者_JAVA百科erface and a DLL that can be embedded in other projects to use some of the other features. Is there a way to make Visual Studio produce both an executable and a DLL (as opposed to switching it manually every time)?
I agree with TJMonk15, but i think this should be explained explicitly. You should have two projects, one project that is a DLL, and one that is a normal project. The DLL project should have all your re-usable code. The normal project should be the application you are building, which will reference your re-usable DLL. This way you can build a framework in the DLL project that can be used for any of your future projects.
A good example of this is when you are making a game. Your game engine would be the DLL, and the game you are making would be the executable project. The executable project will contain all the non-reusable traits such as game GUIs and content.
Why wouldn't you put most of the code in one project (With an ouput of type Library) and then write an executable that referenes the DLL?
精彩评论