项目在命令行和 Visual Studio 中构建,但不在 mac m1pro MSB3971 上的 Rider 中构建

问题描述 投票:0回答:1

我的项目在 Visual Studio for Mac 中构建得很好,但拒绝在 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

我发现的对 NETFramework 的唯一参考是在这里:

enter image description here

我的 csproj 看起来像这样:

<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>

添加此文本,以便我的帖子主要不是代码,不确定我应该在此处添加哪些详细信息。

它在终端和 vs for mac 中构建得很好,但我真的更喜欢使用骑手!

它也无法在骑手中正确加载所有依赖项,但我不确定这是否相关

c# macos apple-m1 rider
1个回答
0
投票

我意识到已经过去 8 个月了,但我也刚刚意识到我从未发布过我的解决方案。如果其他人读到这篇文章也有同样的问题,这似乎是因为该项目最初是一个网络框架项目,并使用 Visual Studio 进行了升级。我发现的唯一真正的解决方案是创建一个新的解决方案并手动复制所有代码。所以在尝试其他任何事情之前先这样做,否则你会浪费很多时间。

© www.soinside.com 2019 - 2024. All rights reserved.