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

10,162

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

Share:
10,162

Related videos on Youtube

antipattern
Author by

antipattern

Updated on September 24, 2022

Comments

  • antipattern
    antipattern over 1 year

    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?

  • Green
    Green over 7 years
    Isn't is stupid to install full Visual Studio when you just need MSBuild tools?
  • xverges
    xverges over 7 years
    @Green, maybe it is stupid. And maybe you could post a more informative comment. In July 2013, having Visual Studio was still the only published approach for my compilation needs github.com/nodejs/node-gyp/commit/…
  • starscream_disco_party
    starscream_disco_party over 4 years
    @xverges that doesn't mean that it's not stupid and a bad design choice by Microsoft