如何在 Visual Studio 2017 项目(新的 .csproj 文件格式)中设置“OutputPath",而目标框架不会弄乱解析的路径?
- 作者: 张伟123666
- 来源: 51数据库
- 2023-02-13
问题描述
在新的 Visual Studio 2017 项目格式中设置 OutputPath 会自动在路径中添加目标框架.例如,如果我在项目文件中设置了这些:
Setting OutputPath in the new Visual Studio 2017 project format automatically adds the target framework in the path. For example, if I have these set in the project file:
<TargetFramework>net462</TargetFramework> <OutputPath>/build/debug/<OutputPath>
实际的输出文件夹将解析为 /build/debug/net462/,而不是像旧版本中的 /build/debug/.如果没有使用构建后操作移动东西等变通方法,我该如何解决这个问题?
The actual output folder will resolve to /build/debug/net462/, not /build/debug/ like in the older versions. How do I solve this without workarounds like moving things around with post build actions?
推荐答案
解决方案是使用 AppendTargetFrameworkToOutputPath https://www.tabsoverspaces.com/233608-stopping-msbuild-appending-targetframework-to-outputpath/
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
推荐阅读
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
热点文章
团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
0
使用 MSBuild.exe 在发布模式下构建 C# 解决方案
0
当我发布 Web 应用程序时,AfterPublish 脚本不运行
0
构建时 T4 转换的产品仅在下一个构建中使用
0
ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
0
新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
0
如何将条件编译符号(DefineConstants)传递给 msbuild
0
MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
0
NuGet 包还原找不到包,没有源
0
使用 C# 6.0 功能运行 TFS 构建
0