.NET 6 System.IO.FileNotFoundException: 无法加载文件或程序集 System.Linq,版本 =6.0.0.0
.NET 6 System.IO.FileNotFoundException: Could not load file or assembly System.Linq, Version=6.0.0.0
我正在尝试将项目从 .NET Core 3.1 迁移到 .NET 6。
我已经关注了 official migration guide from Microsoft.
在构建期间 startup.Configure 我得到
System.IO.FileNotFoundException: 'Could not load file or assembly
'System.Linq, Version=6.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file
specified.'
这是.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>
我不得不将 AzureFunctionsVersion
从 v3
更新到 v4
。那解决了这个问题。
Microsoft 的官方迁移指南中没有提到升级 Azure Functions。
编辑:您还需要升级 Azure Function App。
我正在尝试将项目从 .NET Core 3.1 迁移到 .NET 6。 我已经关注了 official migration guide from Microsoft.
在构建期间 startup.Configure 我得到
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'
这是.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>
我不得不将 AzureFunctionsVersion
从 v3
更新到 v4
。那解决了这个问题。
Microsoft 的官方迁移指南中没有提到升级 Azure Functions。
编辑:您还需要升级 Azure Function App。