版本和publickeytoken相同,但显示“警告MSB3243:无法解决System.IO.Compression版本= 4.1.3.0之间的冲突". [英] Same version and publickeytoken but show "warning MSB3243: No way to resolve conflict between System.IO.Compression, Version=4.1.3.0"

查看:69
本文介绍了版本和publickeytoken相同,但显示“警告MSB3243:无法解决System.IO.Compression版本= 4.1.3.0之间的冲突".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mu csproj:

Mu csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net461;netstandard2.0;net5.0</TargetFrameworks>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System.IO.Compression" />
  </ItemGroup>
</Project>

它具有三个框架.net4.6.1和netstandard2和.net 5

it have three framework .net4.6.1 and netstandard2 and .net 5

和系统显示以下消息

 warning MSB3243: No way to resolve conflict between "System.IO.Compression, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.IO.Compression". Choosing "System.IO.Compression, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.

我对此感到困惑,它们的版本publickeytoken相同.

I'm confuse about it, their version publickeytoken are same.

完整代码

Severity    Code    Description Project File    Line    Suppression State
Warning MSB3245 Could not resolve this reference. Could not locate the assembly "System.IO.Compression". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.    MiniExcelLibs   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets   2182    
Warning MSB3245 Could not resolve this reference. Could not locate the assembly "System.IO.Compression". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.    MiniExcelLibs   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets   2182    
Warning MSB3243 No way to resolve conflict between "System.IO.Compression, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.IO.Compression". Choosing "System.IO.Compression, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. MiniExcelLibs   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets   2182    
Warning MSB3243 No way to resolve conflict between "System.IO.Compression, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.IO.Compression". Choosing "System.IO.Compression, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. MiniExcelLibs   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets   2182    


谢谢,我该如何处理警告或设置配置以忽略它.

How can I deal the waring or set configution to ignore it, thanks.

更新:

我尝试为每个框架设置版本,但不起作用

I've tried set version for each framework, but not work

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup Condition=" '$(TargetFramework)' == 'net461'">
    <Reference Include="System.IO.Compression" Version="4.1.3.0"  />
  </ItemGroup>
  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
    <Reference Include="System.IO.Compression" Version="4.1.3.0"  />
  </ItemGroup>
  <ItemGroup Condition=" '$(TargetFramework)' == 'net5.0'">
    <Reference Include="System.IO.Compression" Version="5.0.0.0"  />
  </ItemGroup>
</Project>

推荐答案

https://github.com/dotnet/sdk/issues/16407

marcpopMSFT

您可以尝试删除对System.IO.Compression的引用吗?该文件是.net Core运行时的一部分,所有运行时程序集在您的项目中都被隐式引用,以使新开发人员更容易使用.NET,即使无需引用也是如此,因此您不需要该引用.看起来它正在运行时中找到该版本以及您直接引用的版本,并警告您实际上已两次引用该版本.

Can you try removing the references to System.IO.Compression? That file is part of the .net Core runtime and all runtime assemblies are implicitly referenced in your project to make it easier for new developers to use .NET even without having to reference is so you shouldn't need that reference. It looks like it's finding the version in the runtime and the version you directly referenced and giving you a warning that you're essentially referencing it twice.

然后按如下所示更新csproj,它可以解决我的问题

and I update csproj as below, it can solve my problem

  <ItemGroup Condition=" '$(TargetFramework)' == 'net461'">
    <Reference Include="System.IO.Compression"  />
  </ItemGroup>

这篇关于版本和publickeytoken相同,但显示“警告MSB3243:无法解决System.IO.Compression版本= 4.1.3.0之间的冲突".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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