.NET Core 3.1-无法加载文件或程序集System.Runtime,版本= 4.2.2.0 [英] .NET Core 3.1 - Could not load file or assembly System.Runtime, Version=4.2.2.0

查看:73
本文介绍了.NET Core 3.1-无法加载文件或程序集System.Runtime,版本= 4.2.2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET Core 3.1控制台应用程序在生成过程中生成错误-

.NET Core 3.1 console app generates error during build -

System.IO.FileNotFoundException:无法加载文件或程序集'System.Runtime,版本= 4.2.2.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'.系统找不到文件指定.

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

但是它适用于.NET Core 3.0版本.

But it works on .NET Core 3.0 version.

我正在使用Microsoft.Orleans.这是csproj-

I'm using Microsoft.Orleans. This is csproj -

    <Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Orleans.Core" Version="3.0.2" />
    <PackageReference Include="Microsoft.Orleans.OrleansCodeGenerator.Build" Version="3.0.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>

推荐答案

在我的情况下,Nischal Nigam的解决方案没有解决,所以我做了更新包 Microsoft.NET.Sdk.Functions 从版本 1.0 ... 3.0.11 ,然后它开始正常工作.

In my case Nischal Nigam's solution didn't worked out, so what I did, I updated the package Microsoft.NET.Sdk.Functions from version 1.0... to 3.0.11 and after that it started working just fine.

这篇关于.NET Core 3.1-无法加载文件或程序集System.Runtime,版本= 4.2.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆