Mismatched dependency version when using Google.Cloud.VertexAI.Extensions
#### Environment details
- OS: macOS 26.2
- .NET version: .NET SDK 10.0.101
- Package name and version: Google.Cloud.VertexAI.Extensions version 1.0.0-beta02
#### Steps to reproduce
1. `dotnet new console`
2. `dotnet add package Google.Cloud.VertexAI.Extensions --version 1.0.0-beta02`
3. Set the contents of `Program.cs` to the following:
```csharp
using Microsoft.Extensions.AI;
using System;
var chatClient = CreateVertexAiChatClient();
await foreach (var message in chatClient.GetStreamingResponseAsync(new ChatMessage(ChatRole.User, "Say 'hi'.")))
{
Console.Write(message.Text);
}
static IChatClient CreateVertexAiChatClient()
{
const string GCP_PROJECT_ID = "!!!!!! YOUR PROJECT ID GOES HERE !!!!!!";
const string GCP_REGION = "us-central1";
var builder = new Google.Cloud.AIPlatform.V1.PredictionServiceClientBuilder()
{
Endpoint = $"https://{GCP_REGION}-aiplatform.googleapis.com",
QuotaProject = GCP_PROJECT_ID,
};
string model = $"projects/{GCP_PROJECT_ID}/locations/{GCP_REGION}/publishers/google/models/gemini-2.5-flash-lite";
return Google.Cloud.VertexAI.Extensions.VertexAIExtensions.BuildIChatClient(builder, defaultModelId: model);
}
```
#### Expected Result
Prints the output of the LLM.
#### Actual Result
An error occurs:
```
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at Google.Cloud.VertexAI.Extensions.VertexAIExtensions.BuildIChatClient(PredictionServiceClientBuilder builder, String defaultModelId, IServiceProvider provider)
at Program.<<Main>$>g__CreateVertexAiChatClient|0_0() in /Users/austin/src/test-vertex-ai-extenstions/Program.cs:line 22
at Program.<Main>$(String[] args) in /Users/austin/src/test-vertex-ai-extenstions/Program.cs:line 4
at Program.<Main>(String[] args)
```
#### Workaround
Directly reference the `Microsoft.Bcl.AsyncInterfaces` Nuget package:
```
dotnet add package Microsoft.Bcl.AsyncInterfaces --version 10.0.1
```
#### Analysis
The `Google.Cloud.VertexAI.Extensions` Nuget package [declares](https://www.nuget.org/packages/Google.Cloud.VertexAI.Extensions/1.0.0-beta02#dependencies-body-tab) dependencies on two packages (`Google.Cloud.AIPlatform.V1` and `Microsoft.Extensions.AI.Abstractions`). When the package is restored, version 6.0.0 of `Microsoft.Bcl.AsyncInterfaces` is restored. According to the `project.assets.json` file, this version of the dependency is installed because package `Google.Api.Gax` version 4.12.1 depends on it.
However the .NET Standard version of `Google.Cloud.VertexAI.Extensions.dll` depends on version 10.0.0 of the `Microsoft.Bcl.AsyncInterfaces` assembly.
To fix this problem, I think the `Google.Cloud.VertexAI.Extensions` Nuget package should declare a dependency on `Microsoft.Bcl.AsyncInterfaces` so that it gets a compatible version.
Note that this is not the only undeclared dependency of the `Google.Cloud.VertexAI.Extensions` package. It may be worthwhile adding explicit dependencies on some of the other direct packages to prevent similar issues. Here are all the dependancies of `Google.Cloud.VertexAI.Extensions.dll`.
| Assembly | Version |
| -- | -- |
| Google.Api.Gax | 4.12.1.0 |
| Google.Api.Gax.Grpc | 4.12.1.0 |
| Google.Apis.Auth | 1.72.0.0 |
| Google.Cloud.AIPlatform.V1 | 3.54.0.0 |
| Google.Protobuf | 3.31.1.0 |
| Grpc.Core.Api | 2.0.0.0 |
| Microsoft.Bcl.AsyncInterfaces | 10.0.0.0 |
| Microsoft.Extensions.AI.Abstractions | 10.0.0.0 |
| Microsoft.Extensions.Logging.Abstractions | 6.0.0.0 |
| netstandard | 2.0.0.0 |
| System.Memory | 4.0.2.0 |
| System.Text.Json | 10.0.0.0 |
| System.Threading.Tasks.Extensions | 4.2.1.0 |
关闭于 2026-01-07 1 条评论