43

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
maelgrove
  • 939
  • 3
  • 9
  • 18

1 Answers1

106

You can disable this behaviour by setting:

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

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

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217