Setting custom <OutputPath> in .NET Core (stop adding framework target)?
You can disable this behaviour by setting:
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
This behaviour originates from the Microsoft.NET.Sdk
(see its source)
maelgrove
Updated on June 15, 2022Comments
-
maelgrove almost 2 years
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 inbin\Debug\AnyCPU
.I had the habit of setting those values independent of the current build configuration (in its own
ItemGroup
, together withDocumentationFile
, 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?