2

I have a libary that targets multiple frameworks in the project file.

  <PropertyGroup>
    <TargetFrameworks>netstandard1.1;netstandard2.0;net45</TargetFrameworks>
  </PropertyGroup>

However, when running it on macOS I get the following errors because NETFramework 4.5 is not installed on the macOS.

/usr/local/share/dotnet/sdk/3.1.403/Microsoft.Common.CurrentVersion.targets(1177,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/x.x/Repos/kevbite/CompaniesHouse.NET/src/CompaniesHouse.Tests/CompaniesHouse.Tests.csproj]
/usr/local/share/dotnet/sdk/3.1.403/Microsoft.Common.CurrentVersion.targets(1177,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/x.x/Repos/kevbite/CompaniesHouse.NET/src/CompaniesHouse.IntegrationTests/CompaniesHouse.IntegrationTests.csproj]
/usr/local/share/dotnet/sdk/3.1.403/Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 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/x.x/Repos/kevbite/CompaniesHouse.NET/src/CompaniesHouse/CompaniesHouse.csproj]

How do I only build the projects that are compatible with what is installed on the machine? as I'm not going to be able to get net45 for macOS.

Kevin Smith
  • 13,746
  • 4
  • 52
  • 77

1 Answers1

0

You will not be able to compile something that is targeted for 4.5 with 3.1! There are breaking changes from 3 to 4 (I didn't check it).

But anyways maybe you're really lucky and it works with just changing it to net31, I doubt it.

You can try intall dotnet 45 via mono:

Is there a way to install .net framework 4.5.2 or higher on Mac OS X?

Simon Danninger
  • 458
  • 2
  • 7
  • 1
    This works perfectly fine on Windows with all the framework targets installed and there are no breaking changes between the frameworks in this library. I'll give Mono a try but ideally, I'd like to just work on it without having the extra frameworks. – Kevin Smith Oct 28 '20 at 20:20