Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting custom <OutputPath> in .NET Core (stop adding framework target)? [duplicate]

In traditional .NET applications, it was possible to set a custom <OutputPath> of an assembly in the .csproj file (or via the project properties dialog). A path of e.g. bin\$(Configuration)\$(Platform) resulted in bin\Debug\AnyCPU.

I had the habit of setting those values independent of the current build configuration (in its own ItemGroup, together with DocumentationFile, etc).

When I'm setting up my configuration in the new .NET core .csproj like this...

<OutputPath>bin\$(Configuration)\$(Platform)</OutputPath> <DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile> 

..the following folder structure gets created:

bin\   Debug\     AnyCPU\       MyAssembly.xml       netstandard1.0\         MyAssembly.exe 

So it seems msbuild, or whatever automatically appends the TargetFramework, which is rather annoying.

Is there a way to truly customize the output path or disable this behavior?

like image 565
maelgrove Avatar asked Jul 03 '17 18:07

maelgrove


1 Answers

You can disable this behaviour by setting:

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> 

This behaviour originates from the Microsoft.NET.Sdk (see its source)

like image 99
Martin Ullrich Avatar answered Oct 06 '22 08:10

Martin Ullrich