Search code examples
c#macosapple-m1rider

Project builds in command line and visual studio but not in rider on mac m1pro MSB3971


My project builds fine in visual studio for mac but refuses to build in rider. I get the following error in rider:

0>Microsoft.Common.CurrentVersion.targets(1232,5): Error MSB3971 : The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
0>------- Finished building project: DataMigrationAgent. Succeeded: False. Errors: 1. Warnings: 0

The only reference to NETFramework i found was here:

enter image description here

My csproj looks like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <LangVersion>9</LangVersion>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <OutputPath>bin\Release\net6.0</OutputPath>
    <PlatformTarget>x64</PlatformTarget>
    <DefineConstants>TRACE</DefineConstants>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="appsettings.Development.json" />
    <None Remove="appsettings.json" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="appsettings.Development.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
    <Content Include="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
        <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
        <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
 
        <PackageReference Include="DocumentFormat.OpenXml" Version="2.9.1" />
        <PackageReference Include="FreeSpire.Doc" Version="11.6.0" />
        <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.2" />
        <PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
        <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />

        <PackageReference Include="Serilog" Version="3.0.1" />

        <PackageReference Include="Serilog.Exceptions" Version="8.4.0" />

        <PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />

        <PackageReference Include="SharedKernel" Version="1.2.1" />


    </ItemGroup>

</Project>

adding this text so my post isn#t mostly code, not sure what details i should add here.

It builds fine in terminal and vs for mac, but i really would prefer using rider!

It also doesn't load all dependencies correctly in rider, but i am unsure if that's related


Solution

  • I realise it's been 8 months, but i also just realized that I never posted my solution. If anyone else reading this has the same problem, it seems to come from the fact that the project started as a net framework project and was upgraded using visual studio. The only real solution I found was creating a new solution and copying all code over manually. So just do that before trying anything else since you'll waste a lot of time otherwise.