0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Program.csでAddStackExchangeRedisCacheメソッドを書けない

Posted at

環境

・Blazor Webアプリ
・.NET 9.0

問題

MicroSoftのドキュメントにあったサンプルコードのProgram.csの部分だけ持ってきたら参照不足のエラーが出た。

AddStackExchangeRedisCacheメソッドはMicrosoft.Extensions.DependencyInjection名前空間にあるらしいが、そのパッケージはインストールしてあるしusingも書いてある。

解決

糸口が見つからなかったのでGitHub Copilotに聞いてみると、コードにMicrosoft.Extensions.Caching.StackExchangeRedisのusing句が追加されている。
その名前空間をインストールすると治ったので、AddStackExchangeRedisCacheメソッドを使うにはそっちの名前空間も必要ということか?
それにしてもメソッド名が長い…

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?