My build (in VS2022) has a C++/CLI assembly that needs to reliably reference types the WindowsDesktop.App.Ref
package for .NET 6. Like types in the WindowsBase
assembly. I cannot find a way to do this that works for all developers.
I was trying to use the version found in this folder:
c:/program files/dotnet/packs/windowsdesktop.app.ref
On my brand new machine it looks like this:
But the problem is that different developers have different "latest" version subfolders here One developer has only a subfolder named "6.0.8". Another has "6.0.7". It seems that updating to the latest Visual Studio would install it, but some of us cannot do that right now for unrelated reasons.
So is there some downloadable MS installer I can run, separate from visual studio that can ensure that one specific version like 6.0.11 lives in that folder?
(Then, i could just ask every developer to install it and hard code the .VCXPROJ file)
OR
Is there some other basic .NET 6 base folder that I should be trying to use to get at these types at build time? Like, say maybe this one?
C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App
Because here I see that:
The rules about this stuff confuse me.
You can install either the full SDK with needed version from here (or install via Powershell script, see reference for options).
UPD
As mentioned in comments, you can add FrameworkReference
element to the .vcxproj file (see WPF and Windows Forms usage docs) to allow .NET Core C++/CLI projects usage of Windows Forms and WPF APIs:
<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>