Set custom <OutputPath> in .NET Core (stop adding framework target)?
In traditional .NET applications, it was possible to set a custom <OutputPath>
assembly in a file .csproj
(or through the project properties dialog). The path, for example, bin\$(Configuration)\$(Platform)
led to bin\Debug\AnyCPU
.
I had a habit of setting these values regardless of the current build configuration (in my own ItemGroup
, along with DocumentationFile
, etc.).
When I set 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 is created:
bin\
Debug\
AnyCPU\
MyAssembly.xml
netstandard1.0\
MyAssembly.exe
So it seems like msbuild, or something automatically adds TargetFramework
, which is pretty annoying.
Is there a way to actually tweak the output path or disable this behavior?
source to share
You can disable this behavior by setting:
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
This behavior comes from Microsoft.NET.Sdk
(see its source )
source to share