-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Library name and version
Azure.AI.OpenAI, versions 2.0.0
and 2.1.0
.
Describe the bug
When using version 2.0.0
or newer of the Azure.AI.OpenAI
package on a Linux environment with the .NET 9 SDK, the build fails with error CS0246: The type or namespace name 'OpenAIClient' could not be found
.
This happens despite having the correct using Azure.AI.OpenAI;
directive and a valid project reference. The issue is reproducible in a minimal console application.
Downgrading the package to 1.0.0-beta.12
resolves the compilation issue. This suggests an assembly resolution problem in the v2.x packages on this specific environment, possibly related to the transitive dependency on the OpenAI
package introduced in v2.0.0.
Expected behavior
The project should compile and run successfully without any errors.
Actual behavior
The build fails with the following compilation error:
error CS0246: The type or namespace name 'OpenAIClient' could not be found (are you missing a using directive or an assembly reference?)
Reproduction Steps
- Create a new console application targeting .NET 9.
dotnet new console --framework net9.0
- Add a reference to a failing version of the package.
dotnet add package Azure.AI.OpenAI --version 2.1.0
- Replace the content of
Program.cs
with the following code:using Azure.AI.OpenAI; using Azure; Console.WriteLine("Testing OpenAIClient initialization..."); // This line fails to compile OpenAIClient client = new OpenAIClient(new Uri("[https://dummy.openai.azure.com/](https://dummy.openai.azure.com/)"), new AzureKeyCredential("dummy-key")); Console.WriteLine("SUCCESS! OpenAIClient class was found.");
- Try to build or run the project.
dotnet run
Environment
- OS: Debian GNU/Linux 13 (trixie)
- Architecture: x86_64
- .NET SDK Version: 9.0.305
- IDE: Command Line / VS Code
Full `dotnet --info` output
.NET SDK:
Version: 9.0.305
Commit: 3fc74f3529
Workload version: 9.0.300-manifests.ddedba1d
MSBuild version: 17.14.21+8929ca9e3
Runtime Environment:
OS Name: debian
OS Version: 13
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.305/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.9
Architecture: x64
Commit: 893c2ebbd4
.NET SDKs installed:
9.0.305 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found