Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio project build as an executable AND a DLL

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 want to build as a stand-alone tool (console app) and be available to a couple other tools I'm working on as a class library.

The VS GUI only lets me choose one or the other, and building the proj twice all the time is inconvenient.

How can I set it up to build both output types in a single build job? Do I write some custom MSBuild .targets file or what?

like image 218
East of Nowhere Avatar asked Mar 17 '10 22:03

East of Nowhere


People also ask

How do I create an executable Visual Studio project?

To build your program and create teh executable file choose Build My Project.exe from the Build menu - "My Project" represents teh name you chose for your project and the extension ".exe" is used to designate that the file being created will be an executable file.

How do I create a DLL project in Visual Studio?

To create a DLL project in Visual Studio 2019On the menu bar, choose File > New > Project to open the Create a New Project dialog box. At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Library.

Can a exe link to DLL and static library at the same time?

Yes, the Core and Utils code will be duplicated. Instead of building them as static libs you can build them as dlls and use anywhere. Save this answer.

How do I run a DLL in Visual Studio?

You can easily open a DLL file in Visual Studio the same way you would any other file. To do so, click File in the menu bar at the top, followed by Open. Then click File and select the DLL file you want to open and click Open. This will open the DLL file in a new Resource Editor window.


1 Answers

If I'm not mistaken, you can use the EXE as a class library.
Just add a reference to it, in the other projects. A .NET EXE is just an assembly.

like image 178
Cheeso Avatar answered Oct 09 '22 11:10

Cheeso