2
votes

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?

1
Try to Clean the solution and build again. By the way, what kind of project are you building?slaphshot33324

1 Answers

0
votes

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:

enter image description here

Hope this helps.