I'm playing around with using the new .csproj file format.
I want my project to build to:
C:\Development\Source\DotNet\bin\x64\Debug\
But it seems to be implicitly adding to the path and building it at:
C:\Development\Source\DotNet\bin\x64\Debug\net46
Is there a way to prevent it from doing that?
My project is:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<Platforms>x64</Platforms>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>C:\Development\Source\DotNet\bin\x64\Debug\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="AssetManagement_Gen">
<HintPath>..\..\Development\Source\DotNet\bin\x64\Debug\AssetManagement_Gen.dll</HintPath>
</Reference>
<Reference Include="EXPLink">
<HintPath>..\..\Development\Source\DotNet\bin\x64\Debug\EXPLink.dll</HintPath>
</Reference>
<Reference Include="IvaraCommon">
<HintPath>..\..\Development\Source\DotNet\bin\x64\Debug\IvaraCommon.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\..\Development\Source\DotNet\bin\x64\Debug\NLog.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
</Project>
If I open it in visual studio it also shows up with the "net46" appended to the output path.
For my posterity, the combination of <OutputPath>
and <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
lets you get a completely custom path.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Platforms>x64</Platforms>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>..\..\..\bin\$(Platform)\$(Configuration)</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\..\..\bin\$(Platform)\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="AssetManagement_Gen">
<HintPath>$(OutDir)\AssetManagement_Gen.dll</HintPath>
</Reference>
<Reference Include="EXPLink">
<HintPath>$(OutDir)\EXPLink.dll</HintPath>
</Reference>
<Reference Include="IvaraCommon">
<HintPath>$(OutDir)\IvaraCommon.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>$(OutDir)\NLog.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
</Project>
I found the following post:
https://compiledexperience.com/blog/posts/multi-targeting-output-path
If you want to disable this automatic appending, for instance you’re only going to be using one target framework or you’re defining a different output path per framework then you can use AppendTargetFrameworkToOutputPath.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With