How do I set `OutputPath` in a Visual Studio 2017 project (new .csproj file format) without the target framework cluttering the resolved path?
C#MsbuildVisual Studio-2017C# Problem Overview
Setting OutputPath
in the new Visual Studio 2017 project format automatically adds the target framework in the path. For example, if I have these set in the project file:
<TargetFramework>net462</TargetFramework>
<OutputPath>/build/debug/<OutputPath>
The actual output folder will resolve to /build/debug/net462/
, not /build/debug/
like in the older versions.
How do I solve this without workarounds like moving things around with post build actions?
C# Solutions
Solution 1 - C#
The solution is to use AppendTargetFrameworkToOutputPath
https://www.tabsoverspaces.com/233608-stopping-msbuild-appending-targetframework-to-outputpath/
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
Solution 2 - C#
The answer above is right, but you may also want to remove the runtime identifier:
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>