Visual Studio project build as an executable AND a DLL

后端 未结 5 1470
清酒与你
清酒与你 2021-01-02 03:08

In Visual Studio 2008 project properties, Application tab, I can set the Output type to Windows Application, Console Application, or Class Library. I have a project that I w

5条回答
  •  耶瑟儿~
    2021-01-02 03:55

    You cannot compile to both an exe and a dll. Whether an assembly is treated as an exe or a dll is determined by a single bit flag in the portable executable header of the file (see http://msdn.microsoft.com/en-us/magazine/cc301805.aspx for more info). This flag cannot have both values.

    What you can do to satisfy your need is to add a reference to your exe. You cannot do this in some versions of Visual Studio (2005 and below) as the UI will not let you, but you can hand edit the project file to add the reference. Later versions of Visual Studio do allow you to add references to exe files using the UI.

提交回复
热议问题