'How to reliably reference WindowsBase assembly from C++/CLI

My .NET 6.0 based C++/CLI projects uses WindowsBase with the following in the project file

<Reference Include="WindowsBase">
  <HintPath>$(NetCoreTargetingPackRoot)\Microsoft.WindowsDesktop.App.Ref\6.0.0\ref\net6.0\WindowsBase.dll</HintPath>
</Reference>

Today, my build started failing (couldn't find "WindowsBase" anymore) because the folder I reference was no longer there

C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.0

Instead all I see is

C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\6.0.2

It's great that Microsoft updated me but I am not sure now how to update my build. My co-worker does not have this subfolder. She has 6.0.0 still. Even after running windows update. So I cannot just go into my project file and change the 6.0.0 to 6.0.2 or her machine won't be able to build.

I don't understand how this got deleted out from under me. Does Visual Studio take care of this? Windows? I did not deliberately uninstall it. Not sure what the best approach to take is.

Is there some sort of "currently installed version" macro I can use? Do I try to go manually install 6.0.0 again? Perhaps I should reference a different folder altogether (e.g. dotnet/shared)?

I'm using Visual Studio 2022 version 17.1 if that matters.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source