我正在使用新的.csproj文件格式。
我希望我的项目构建为:
C:\ Development \ Source \ DotNet \ bin \ x64 \ Debug \
但是它似乎隐式地添加到路径并在以下位置进行构建:
C:\ Development \ Source \ DotNet \ bin \ x64 \ Debug \ net46
有办法防止它这样做吗?
我的项目是:
<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>
Run Code Online (Sandbox Code Playgroud)
如果我在Visual Studio中打开它,它还会显示在输出路径上并附加“ net46”。
对于我的后人,组合<OutputPath>,并<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>可以让你得到一个完全自定义路径。
<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>
Run Code Online (Sandbox Code Playgroud)
我发现以下帖子:
https://compiledexperience.com/blog/posts/multi-targeting-output-path
例如,如果要禁用此自动附加,则仅使用一个目标框架,或者为每个框架定义不同的输出路径,则可以使用AppendTargetFrameworkToOutputPath。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
955 次 |
| 最近记录: |