Reputation: 1680
For a visual C# project in microsoft visual studio IDE, what is the configuration settings to be used, so that it could generate both exe and dll outputs?
Upvotes: 1
Views: 3085
Reputation: 14726
I know this is an old question but it is possible to do a lot of things in the proj-files that is not possible in the user interface.
For this specific issue you just do like this:
In the project's csprojfile you will find the following line
<OutputType>Library</OutputType>
After that line add the following line
<OutputType Condition="'$(Configuration)|$(Platform)' == 'ReleaseExe|AnyCPU'">Exe</OutputType>
Save, open the project and use batch build to build both the dll and exe
The nice thing is that you can use the Condition
attibute on all tags in the project file. I have a project where I need to create two versions based on different 3rd party assemblies. To solve that I just add a condition to the reference tag.
<Reference Include="3rdParty" Condition="'$(Configuration)|$(Platform)' == 'Release1|AnyCPU'">
<HintPath>Release1\3rdParty.dll</HintPath>
</Reference>
<Reference Include="3rdParty" Condition="'$(Configuration)|$(Platform)' == 'Release2|AnyCPU'">
<HintPath>Release2\3rdParty.dll</HintPath>
</Reference>
Upvotes: 0
Reputation: 32758
What you want can be easily achieved using nant. You have to create a simple xml file that is the script and that can be easily executed through a batch file. Once you created them then it's very easy no more manual work, every time when you need to build the project all you have to do is just execute the script.
Here is an excellent tutorial about nant.
Upvotes: 2
Reputation: 21521
As Darin points out in comments, there is no setting to do this. However, you can achieve it via build events and batch scripts
You will now get a copy of your csproj generated which outputs to exe. You can add the second csproj into visual studio and every time you build, it should synchronize the exe csproj and build it.
Some tips:
Upvotes: 0