简体   繁体   English

.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

I am trying to migrate a project from .NET Core 3.1 to .NET 6. I have followed the official migration guide from Microsoft .我正在尝试将项目从 .NET Core 3.1 迁移到 .NET 6。我已遵循Microsoft 的官方迁移指南

During build in startup.Configure I get在构建启动期间。配置我得到

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. System.IO.FileNotFoundException:'无法加载文件或程序集'System.Linq,版本 = 6.0.0.0,文化 = 中性,PublicKeyToken = b03f5f7f11d50a3a'。 The system cannot find the file specified.'该系统找不到指定的文件。'

This is.csproj:这是.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>

I had to update AzureFunctionsVersion to v4 from v3 .我不得不将AzureFunctionsVersionv3更新到v4 That solved the issue这解决了问题

My case is different from the OP's but I want to share it for information.我的案例与 OP 的案例不同,但我想分享它以获取信息。 I run into this error when I try to use dnSpy to patch a C# DLL.当我尝试使用 dnSpy 修补 C# DLL 时遇到此错误。 It turns out the dnSpy compilation is targeting dependencies of my development machine.事实证明 dnSpy 编译针对的是我的开发机器的依赖项。 When I move the compiled DLL to the target machine, this error is raised as the dependencies are not met there.当我将编译后的 DLL 移动到目标机器时,由于在那里不满足依赖关系而引发此错误。 I have to compile it again on my target machine and the error is gone.我必须在我的目标机器上再次编译它,错误就消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.IO.FileNotFoundException:无法加载文件或程序集&#39;System.Net.Security,Version = 4.0.0.0 - System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Security, Version=4.0.0.0 System.IO.FileNotFoundException:无法加载文件或程序集System.Xml.Linq - System.IO.FileNotFoundException: Could not load file or assembly System.Xml.Linq 无法加载文件或程序集System.IO.FileNotFoundException - Could not load file or assembly System.IO.FileNotFoundException System.IO.FileNotFoundException:无法加载文件或程序集 - System.IO.FileNotFoundException: Could not load file or assembly System.IO.FileNotFoundException: '无法加载文件或程序集 - System.IO.FileNotFoundException: 'Could not load file or assembly 奇怪的错误:System.IO.FileNotFoundException:无法加载文件或程序集 - Weird Error: System.IO.FileNotFoundException: Could not load file or assembly System.IO.FileNotFoundException: 无法加载文件或程序集 C# - System.IO.FileNotFoundException: Could not load file or assembly C# Google Api-System.IO.FileNotFoundException:无法加载文件或程序集“ System.Net.Http.Primitives” - Google Api - System.IO.FileNotFoundException : Could not load file or assembly 'System.Net.Http.Primitives' System.IO.FileNotFoundException: &#39;无法加载文件或程序集 &#39;Newtonsoft.Json,版本 = 12.0.0.0, - System.IO.FileNotFoundException: 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, System.IO.FileNotFoundException:无法加载文件或程序集&#39;Microsoft.WindowsAzure.ServiceRuntime,版本= 2.5.0.0 - System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.5.0.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM