NOC*_*NOC 13 visual-studio-2022
Visual Studio 2022 正在将子文件夹添加到基本输出路径。
有没有办法阻止它将 Release/Debug 子文件夹添加到输出路径?
小智 9
这是基于Microsoft 调试器设置的完整解决方案:
PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath><OutputPath>C:\[full directory path]\[name of project]</OutputPath>输出路径是一堆 MSBuild 属性的串联。根据您的项目类型,它可能发生在项目文件中、显式导入的目标文件中或隐式导入(例如通过 MSBuild SDK)中。在任何这些情况下,您应该能够通过在项目文件中显式设置值来覆盖它。
以第三种情况为例(使用 Microsoft.NET.Sdk),在 Microsoft.NET.DefaultOutputPaths.targets 中,您将找到如下指定的默认值:
<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>
Run Code Online (Sandbox Code Playgroud)
请注意 基本上是如何$(OutputPath)将 附加$(Configuration)到 的$(BaseOutputPath)。
如果你想总是有相同的输出路径,你可以<OutputPath>Your\Desired\Path</OutputPath>在你的项目文件中设置。设置该值后,将根据 now-false 条件('$(OutputPath)'不再为空)跳过上面的默认逻辑。
但是,如果您构建不同的配置而不删除构建之间的输出文件夹的内容,这可能会破坏增量构建。
| 归档时间: |
|
| 查看次数: |
5752 次 |
| 最近记录: |