-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the bug
When referencing Microsoft.SemanticKernel.Connectors.InMemory or Microsoft.SemanticKernel.Connectors.SqliteVec (and likely others) from a .NETFramework project a warning is emitted from ResolveAssemblyReferences.
warning MSB3277: Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved.
To Reproduce
Steps to reproduce the behavior:
- Create a new project targeting .NETFramework. eg:
net48 - Add a reference to
Microsoft.SemanticKernel.Connectors.InMemory - Build
- Observe warning:
C:\Program Files\dotnet\sdk\10.0.100-rtm.25476.104\Microsoft.Common.CurrentVersion.targets(2437,5): warning MSB3277:
Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved.
There was a conflict between "Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2d
dd51".
"Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7
b13ffcd2ddd51" was not.
References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [C:\Users\ericstj\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.8\lib\net462\Microsoft.Bcl.
AsyncInterfaces.dll].
C:\Users\ericstj\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll".
C:\Users\ericstj\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
References which depend on or have been unified to "Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [].
C:\Users\ericstj\.nuget\packages\microsoft.extensions.ai.abstractions\9.9.1\lib\net462\Microsoft.Extensions.AI.Abstractions.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.extensions.ai.abstractions\9.9.1\lib\net462\Microsoft.Extensions.AI.Abstractions.dll".
C:\Users\ericstj\.nuget\packages\microsoft.extensions.ai.abstractions\9.9.1\lib\net462\Microsoft.Extensions.AI.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.extensions.vectordata.abstractions\9.7.0\lib\net462\Microsoft.Extensions.VectorData.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
C:\Users\ericstj\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\9.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\9.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll".
C:\Users\ericstj\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\9.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
C:\Users\ericstj\.nuget\packages\microsoft.extensions.vectordata.abstractions\9.7.0\lib\net462\Microsoft.Extensions.VectorData.Abstractions.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.extensions.vectordata.abstractions\9.7.0\lib\net462\Microsoft.Extensions.VectorData.Abstractions.dll".
C:\Users\ericstj\.nuget\packages\microsoft.extensions.vectordata.abstractions\9.7.0\lib\net462\Microsoft.Extensions.VectorData.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll".
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
C:\Users\ericstj\.nuget\packages\system.text.json\8.0.6\lib\net462\System.Text.Json.dll
Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\system.text.json\8.0.6\lib\net462\System.Text.Json.dll".
C:\Users\ericstj\.nuget\packages\system.text.json\8.0.6\lib\net462\System.Text.Json.dll
C:\Users\ericstj\.nuget\packages\microsoft.extensions.ai.abstractions\9.9.1\lib\net462\Microsoft.Extensions.AI.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.extensions.vectordata.abstractions\9.7.0\lib\net462\Microsoft.Extensions.VectorData.Abstractions.dll
C:\Users\ericstj\.nuget\packages\microsoft.semantickernel.connectors.inmemory\1.66.0-preview\lib\net462\Microsoft.SemanticKernel.Connectors.InMemory.dll
If this warning is ignored and you try to use API from this package that requires async interfaces, you'll see an exception:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.66.0-preview" />
</ItemGroup>
</Project>Repro project -- semanticKernelDowngrade.zip
Expected behavior
Builds successfully.
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
- Language: C#
- Source: NuGet package version
1.66.0-preview - AI model: n/a
- IDE: dotnet cli, but all would repro
- OS: any
Additional context
This bug exists because you are versioning and publishing nuget packages incorrectly.
This packages (Microsoft.SemanticKernel.Connectors.InMemory) depends on other packages (Microsoft.Extensions.VectorData.Abstractions) which are building and changing but not versioning nor publishing. Those changes (versions of dependencies) were visible transitively to the refencing packages, but never shipped.
You cannot selectively version and publish packages like this unless you are extremely careful about never making any observable changes from the dependent package. API, assembly names, and dependencies are visible to the referencing packages. It would be very hard not to somehow observe dependency versions.
To avoid this problem, ensure that when you publish packages you version and publish the entire package closure of the packages you build.