msbuild - 如何强制 msbuild 忽略警告 MSB8012

标签 msbuild

我知道这个问题已经讨论了数百次,但我仍然找不到解决方案。也许 msbuild 中发生了一些变化,但我不知道。问题是我收到以下警告

warning MSB8012: TargetPath(d:\src\output\Techd.dll) does not match the Linker's OutputFile 
property value (d:\src\output\Debug32\bin\Techd.dll). This may cause your project to build 
incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and
$(TargetExt) property values match the value specified in %(Link.OutputFile).

我通过属性更改outdir

msbuild.wxw /p:OutDir="my_out_dir"

我无法更改项目属性,也不允许修改 msbuild 目标文件 (Microsoft.CppBuild.targets)。因此,没有任何想法强制 msbuild 忽略此警告或忽略 $OutDir 变量的更改。

最佳答案

您应该能够使用命令行参数消除 MSBuild 警告:

msbuild.exe /nowarn:MSB8012

在即将发布的 MSBuild/VS2017 (15.3) 更新中,您可以指定属性来控制项目文件中的 MSBuild 警告作为属性,这样它也会影响 VS 中的构建:

<MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>

关于msbuild - 如何强制 msbuild 忽略警告 MSB8012,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43887320/

相关文章:

c# - 用于 TFS 持续集成的 NuGet 包

.net - DNU 从 MSBuild 发布 --no-source

msbuild - 如何在 MSBuild 中获取 Windows SDK 文件夹?

azure-devops - Azure Devops Pipeline - 使用 Microsoft Visual Studio 安装程序项目

visual-studio-2013 - VS2013 C++ : slow linking process

unit-testing - 无法使用Visual Studio 2017 RC进行XUnit测试

visual-studio - Visual Studio 如何决定何时以及如何重建 IntelliSense?

azure - 将生成的 XML 文档包含在 Azure 云服务包中

msbuild - 如何通过 Jenkins 中的批处理命令仅触发 web.config 转换

c# - Visual Studio 2013 C# 构建输出到文件