Gayane
Gayane

Reputation: 637

How to force msbuild to ignore warning MSB8012

I know this question was discussed hundreds of times, but I still cannot find solution. Maybe something was changed in msbuild and I am not aware. The problem is that I get the following warning

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).

I change the outdir by property

msbuild.wxw /p:OutDir="my_out_dir"

I cannot change projects properties and I am not allowed to modify msbuild target files (Microsoft.CppBuild.targets). So don't have any idea hot to force msbuild to ignore this warning or to ignore the $OutDir variable's change.

Upvotes: 2

Views: 3056

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

You should be able to silence MSBuild warnings using a command line parameter:

msbuild.exe /nowarn:MSB8012

In an upcoming update to MSBuild/VS2017 (15.3), you can specify properties to control MSBuild warnings in project files as a property, so that it also affects builds in VS:

<MSBuildWarningsAsMessages>MSB8012</MSBuildWarningsAsMessages>

Upvotes: 5

Related Questions