antipattern
antipattern

Reputation: 760

Why does MSBuild look for Microsoft.Cpp.Default.props in a unrelated location

I have a Problem which pretty much the bears same anatomy as this post:

Why does MSBuild look in C:\ for Microsoft.Cpp.Default.props instead of c:\Program Files (x86)\MSBuild? ( error MSB4019)

Adding the registry (as per the suggestion from Peter Kahn in that other post) did not appear to help, even though it was previously missing. I do have all the files in the correct directory, that is

c:\Program Files (X86)\MSBuild\Microsoft.Cpp\v4.0\V110

See, if I chose following as MSBuildExtensionsPath

MSBuildExtensionsPath32 = C:\Program Files (x86)\MSBuild

together with the registry

HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersion\4.0\VCTargetsPath=$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V110

HKLM\SOFTWARE\WoW6432Node\Microsoft\MSBuild\ToolsVersion\4.0\VCTargetsPath=$(MSBuildExtensionsPath64)\Microsoft.Cpp\v4.0\V110

This should, in theory, end up with the directory where files are stored. But in practice, MSBuild is looking somewhere else:

error MSB4019: The imported project "C:\MSBuild\Microsoft.Cpp.props" could not be found.[..]

Even more puzzling: If the $(MSBuildExtensionsPath) is changed to something not in c:\Program Files (X86)\ - for example this:

MSBuildExtensionsPath32 = C:\test\MSBuild

The resulting error message changes and surprisingly, the path is collated properly:

error MSB4019: The imported project "C:\test\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.default.props" could not be found.[..]

Interestingly, this file in fact does exist (copied it there..) and it is still not found. WTH is wrong?

Upvotes: 4

Views: 10516

Answers (1)

xverges
xverges

Reputation: 4718

Although I hate as much as anyone else uninstalling and reinstalling stuff, https://stackoverflow.com/a/16213408/239408 worked for me and did not require any troubleshooting...

Upvotes: 1

Related Questions