<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>C:\[full directory path]\[name of project]</OutputPath>
<PropertyGroup>
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<IsPackable>false</IsPackable>
<BaseOutputPath>bin\</BaseOutputPath>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<IsPackable>false</IsPackable>
<OutputPath>bin\</OutputPath>
<IntermediateOutputPath>obj\</IntermediateOutputPath>
</PropertyGroup>
输出路径是一堆MSBUILD属性的串联。 根据您的项目类型,它可以在项目文件中,明确导入的目标文件或通过MSBUILD SDK等隐性导入中发生。 在这些情况下,您应该能够通过明确设置项目文件中的值来覆盖它。
<BaseOutputPath Condition="'$(BaseOutputPath)' == ''">bin\</BaseOutputPath>
<BaseOutputPath Condition="!HasTrailingSlash('$(BaseOutputPath)')">$(BaseOutputPath)\</BaseOutputPath>
<OutputPath Condition="'$(OutputPath)' == '' and '$(PlatformName)' == 'AnyCPU'">$(BaseOutputPath)$(Configuration)\</OutputPath>
<OutputPath Condition="'$(OutputPath)' == '' and '$(PlatformName)' != 'AnyCPU'">$(BaseOutputPath)$(PlatformName)\$(Configuration)\</OutputPath>
<OutputPath Condition="!HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
注意,
$(OutputPath)
基本上是如何将$(BaseOutputPath)
如果您想始终具有相同的输出路径,则可以在项目文件中设置
<OutputPath>Your\Desired\Path</OutputPath>
。 设置该值后,将根据现在的false条件跳过上面的默认逻辑(
'$(OutputPath)'
不再为空)。
,但是,如果您构建不同的配置而不删除构建之间的输出文件夹的内容,则可能会破坏增量构建。