版本和publickeytoken相同,但显示“警告MSB3243:无法解决System.IO.Compression版本= 4.1.3.0之间的冲突".

编程入门 行业动态 更新时间:2024-10-20 01:33:04
本文介绍了版本和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>

它具有三个框架4.6.1和netstandard2和 5

it have three framework 4.6.1 and netstandard2 and 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>

推荐答案

github/dotnet/sdk/issues/16407

marcpopMSFT 说

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

Can you try removing the references to System.IO.Compression? That file is part of the 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之间的冲突"

本文发布于:2023-11-09 20:44:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573394.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   冲突   System   IO   publickeytoken

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!