【问题标题】:.NET 6 System.IO.FileNotFoundException: Could not load file or assembly System.Linq, Version=6.0.0.0.NET 6 System.IO.FileNotFoundException:无法加载文件或程序集 System.Linq,版本 = 6.0.0.0
【发布时间】:2021-12-27 12:07:03
【问题描述】:

我正在尝试将项目从 .NET Core 3.1 迁移到 .NET 6。 我关注了official migration guide from Microsoft

在启动期间构建。配置我得到

System.IO.FileNotFoundException: '无法加载文件或程序集 'System.Linq,版本=6.0.0.0,文化=中性, PublicKeyToken=b03f5f7f11d50a3a'。系统找不到文件 指定。'

这是.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <AssemblyName>Omicron.Insurance.Runner</AssemblyName>
    <RootNamespace>Omicron.Insurance.Runner</RootNamespace>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Omicron.Insurance.Entities" Version="1.0.139" />
    <PackageReference Include="Omicron.Platform.Web.ApplicationInsights" Version="3.1.60" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.22" />
      <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.1" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
    <PackageReference Include="NodaTime" Version="3.0.9" />
    <PackageReference Include="ServiceBus.AttachmentPlugin" Version="6.2.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

【问题讨论】:

  • 尝试手动添加?

标签: c# .net migration .net-6.0


【解决方案1】:

我必须将 AzureFunctionsVersionv3 更新为 v4。这解决了这个问题。 Microsoft 的官方迁移指南中没有提到升级 Azure Functions。

【讨论】:

    猜你喜欢
    • 2015-12-18
    • 1970-01-01
    • 2023-01-20
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多