2

I'm building an Unreal project through TeamCity and my msbuild step is failing with the following error:

error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.

I have VS 2019 installed and VCTargetsPath set to:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140

I can confirm that the file does exist in the link above.

Stu456
  • 51
  • 1
  • 7
  • 1
    Search for that in your project file. It might rely on an environment variable or something that you haven't set – paddy Nov 25 '21 at 12:13
  • 1
    You should rarely if ever have to set VCTargetsPath manually (though TeamCity might need an env.VisualStudioVersion parameter IIRC); also that path points to something with v14.0, that's not what VS2019 normally uses right? Anyway the problem might be in how you call msbuild in TeamCity. What settings do you use and which build runner? – stijn Nov 25 '21 at 16:19
  • The runner is .NET with an MSBuild command using cross-platform MSBuild.....This seems partly resolved by restarting the build server after setting the environment variable. But now my 'Platform' is 'Invalid'. Though I have no idea how this is set. – Stu456 Nov 25 '21 at 16:32
  • duplicate of https://stackoverflow.com/questions/41695251/c-microsoft-cpp-default-props-was-not-found https://stackoverflow.com/questions/16092169/why-does-msbuild-look-in-c-for-microsoft-cpp-default-props-instead-of-c-progr – john k May 04 '22 at 13:55
  • Another relevant environment variable, that solved this issue for me is MSBuildSDKsPath. Just in case someone stumbles across this. I haven't found that solution on SO, but got it here: https://github.com/dotnet/sdk/issues/10229 – Jason Bray Jul 29 '22 at 15:58

0 Answers0