When I try to build one project with Visual Studio 2017, I got following error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Why it imports the V140\Microsoft.cpp.props
, I did not install Visual Studio 2015 on my PC.
How to resolve this issue?
error MSB4019: The imported project “C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props” was not found
If you build the project with MSBuild command line, you should specify the parameter /p:VisualStudioVersion=15.0
in you command line, like:
msbuild.exe <project or solution to build> /p:VisualStudioVersion=15.0
Check the this thread for some more details.
If you build it with Visual Studio 2017, you can overwrite the value of $(VCTargetsPath)
:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\
Also you can try to install the Visual Studio 2015 compiler tools:
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With