使用VS 2019,我的一些项目在编译时生成此生成警告:
Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2081,5):
5>C:\Program Files (x86)\Microsoft Visual 5>C:\Program warning MSB3277:发现无法解决的"Microsoft.EntityFrameworkCore“不同版本之间的冲突。当日志详细设置为详细时,这些引用冲突将在构建日志中列出。
因为原木不是真的..。详细(即使是在详细模式下),我做了一些调查,似乎错误是由Pomelo.EntityFrameworkCore.Mysql/3.1.2 (我们正在使用MariaDB)引起的。下面是一个项目json的摘录,它依赖于EF 3.1.0,而当前版本是3.1.6:
"Pomelo.EntityFrameworkCore.MySql/3.1.2": {
"type": "package",
"dependencies": {
"Microsoft.EntityFrameworkCore.Relational": "3.1.0",
"MySqlConnector": "[0.61.0, 1.0.0)",
"Pomelo.JsonObject": "2.2.1"
},
下面是正在发生警告的测试项目的PackageReference包含部分的示例:
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="XmlUnit.Core" Version="2.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
我该怎么办:
忽略此警告(并等待dependency)
BR
发布于 2020-08-06 16:33:43
测试项目忽略了对问题包的引用。仅仅将它们添加到您在第二个项目中引用的项目是不够的。
因此,将它们添加到testproject中:
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.6" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" />
如果仍然存在与System.Configuration.ConfigurationManager相关的问题,还可以添加
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
参加测试。
https://stackoverflow.com/questions/63230575
复制相似问题