禁用vcproj中输出文件夹的配置名称

发布于 2025-01-18 03:10:58 字数 176 浏览 4 评论 0原文

在 C# csproj 项目中,AppendTargetFrameworkToOutputPath 和 AppendRuntimeIdentifierToOutputPath 会阻止 msbuild 在生成输出目录中为目标框架和运行时创建子文件夹。但是,仍会附加配置名称。

是否有配置选项可以防止每个配置都有单独的子文件夹?

In a C# csproj project, AppendTargetFrameworkToOutputPath and AppendRuntimeIdentifierToOutputPath prevent msbuild from creating subfolders for target framework and runtime in the build output directory. However, the configuration name is still appended.

Is there a configuration option to prevent a separate subfolder for each configuration?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初与友歌 2025-01-25 03:10:58

所以我想出了一个解决方案。在 Visual Studio 中编辑项目设置时,它会修改 XML 项目文件中的 元素。只需将元素名称更改为 即可,它不会附加配置名称(正如您所说,添加 falsefalse 以禁用附加目标框架和运行时标识符)。

例如,我在 C# 项目的 中有以下内容:

<OutputPath>$(SolutionDir)Build\$(Configuration)\Plugins</OutputPath> 
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

对于调试构建,这会将构建文件输出到 \Build\Debug\插件

So I figured out a solution to this. When editing the project settings in Visual Studio, it modifies the <BaseOutputPath> element in the XML project file. Simply change the element name to <OutputPath> instead, and it won't append the configuration name (and as you said, add <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> and <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> to disable appending target framework and runtime identifier).

As an example, I have the following in a <PropertyGroup> in a C# project:

<OutputPath>$(SolutionDir)Build\$(Configuration)\Plugins</OutputPath> 
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

For a debug build, this will output the build files to <SolutionDir>\Build\Debug\Plugins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文