dotnet run reporting '.NETFramework,Version=v4.8 were not found'

Im getting the following error when running 'dotnet run' on my Mac OS/usr/local/share/dotnet/sdk/5.0.300/Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.8 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 [/Users/tommie/projects/zzz/zzz/zzz.csproj]

My code is from Visual Studio 8.9 and only supports up to 4.8 on the .net frameworks However when I look at the 'https://aka.ms/msbuild/developerpacks' 4.8 is not available. Only 5.0 is available. 5.0 is apparently supported in Visual Studio 8.10 but is not a formal release yet.


Solution 1:

I ran into this exact error on my Jenkins server performing a job using MSBUILD: error MSB3644: The reference assemblies for .NETFramework,Version=v4.8 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. There was some back and forth about Visual Studio and about MacOS which muddled things a little, but for me, installing ".NET Framework 4.8 Developer Pack Offline Installer" as suggested by Alsein corrected my problem. Link here https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net48-developer-pack-offline-installer