LoginSignup
0
0

dotnet CLIでNugetパッケージ追加時に出たエラーの対処

Posted at

VSCodeでC#の開発環境を構築しようとしている際、dotnet CLIを用いてNugetパッケージの追加しようとしたのですがエラーが出たのでその時の対処内容のメモです。

OS:Windows10
利用SDK:.NET 7.0 SDK(v7.0.404)

症状

NugetパッケージのAzure.AI.OpenAIをインストールしようとして以下のコマンドを実行しました。

dotnet add package Azure.AI.OpenAI --prerelease

すると以下のようなエラーが出力されました。

error: パッケージ 'Azure.AI.OpenAI' に使用できるバージョンがありません。

原因・解決方法

原因はdotnet CLIのパッケージソースにnuget.orgが登録されていないためでした。

以下を実行することでnuget.orgをNugetソースとして登録することができ、Azure.AI.OpenAIの追加コマンドが正常に実行できました。

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

参考:https://learn.microsoft.com/ja-jp/dotnet/core/tools/dotnet-nuget-add-source

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0