Search code examples
c++-cliclrvisual-studio-2019

Brand new CLR Class Library project won't build: missing MSCOREE.lib


Using the latest Visual Studio 2019 version, a brand new project will not build:

fatal error LNK1104: cannot open file 'MSCOREE.lib'

I have tried to re-install Visual Studio but that didn't change anything unfortunately.

These components have been selected by the installer but apparently it's not enough:

  • MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.24)
  • Windows 10 SDK (10.0.18362.0)
  • C++/CLI support for v142 build tools (14.24)

Question:

Are there any tricks to get CLR Class Library (.NET Framework) projects to build ?


Solution

  • Here is the solution:

    Apparently, no matter what framework version you will target, the $(NETFXKitsDir)Lib\um\x86 macro will always point to C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x86.

    Now here's the problem, even though you install 4.7.2 SDK in Visual Studio Installer, this file is nowhere to be seen.

    But if you download .NET Framework 4.7.2 Developer Pack Offline Installer and press the Repair button, it gets correctly installed and a brand new project will build succesfully.

    Alternatively:

    Re-installing VS also fixes the issue ...