Search code examples
c#.netunity-game-enginechocolateyomnisharp

.NET not finding choco-installed Developer Pack reference assemblies


I've setup Unity for VSCode, but Omnisharp Log is showing

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1217,5):
Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found.
To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework
version or retarget your application.
You can download .NET Framework Developer Packs at
https://aka.ms/msbuild/developerpacks

I avoid .exe installers in favor of using package managers, so I've already installed .net and the developer rpack using Chocolatey.

choco install dotnet
choco install choco install netfx-4.8-devpack

and rebooted my system.The error persists.

I'm assuming VSCode is simply not able to find the path it's installed to because I installed through Choco rather than the Microsoft exe installer. Is that what's happening? How can I confirm and fix it?

Output of choco list --localonly

chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-dotnetfx.extension 1.0.1
chocolatey-visualstudio.extension 1.10.2
chocolatey-windowsupdate.extension 1.0.5
dotnet-7.0-sdk 7.0.202
dotnet-7.0-sdk-2xx 7.0.202
dotnet-sdk 7.0.202
DotNet4.5.2 4.5.2.20140902
dotnetfx 4.8.0.20220524

Solution

  • It's targeting the framework version 4.7.1, not 4.8.0.

    Install the devpack for that version specifically

    choco install dotnetfx-4.7.1-devpack