magol
magol

Reputation: 6273

Target framework in output file name from C# when using multi targets

When I compile a C# application, the filename of the output is ProjectName.dll. But how do I do if I want the filename to be ProjectName.net46.dll?

Edit

I want that the outputs to be ProjectName.net46.dll and ProjectName.net40.dll if I use <TargetFrameworks>net46;net40</TargetFrameworks>

Upvotes: 0

Views: 548

Answers (1)

magol
magol

Reputation: 6273

After some investigations, I found this line. Based on this, the solution turn out to be as simple as this:

  <PropertyGroup>
    <TargetFrameworks>net4.0;net4.6</TargetFrameworks>
    <AssemblyName>$(MSBuildProjectName).$(TargetFramework)</AssemblyName>
  </PropertyGroup>

With this solution, both the *.exe, *.dll and *.pdb files are geting the new name. And this solution also make debugging and unit testing work.

Upvotes: 1

Related Questions