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?

【C#】AspireCLI(ver13.1.2)でホットリロードをするように設定

0
Posted at

はじめに

.NET Aspire CLI のバージョン13系では、以前存在していたホットリロード用の -w オプションが廃止されました。
本記事では、バージョン13.1.2 時点での代替手段としてコンフィグによるホットリロード有効化の方法をまとめます。

以前の挙動と変更点

以前のバージョンでは aspire run -w のように -w オプションを付けることで dotnet watch と同様の変更検知が可能でした。
しかし 2026/03/08 現在、aspire run -h でヘルプを確認するとそのオプションは存在しません。

# Aspire runのヘルプ
> aspire run -h
Description:
  開発モードで Aspire AppHost を実行します。

使用法:
  aspire run [options] [[--] <additional arguments>...]]

オプション:
  --project <project>  Aspire AppHost プロジェクト ファイルへのパス。
  -?, -h, --help       Show help and usage information
  -d, --debug          コンソールへのデバッグ ログを有効にします。
  --non-interactive    Run the command in non-interactive mode, disabling all interactive prompts and spinners
  --wait-for-debugger  デバッガーがアタッチされるまで待ってから、コマンドを実行します。

追加引数:
  Arguments passed to the application that is being run.

解決策:コンフィグでホットリロードを有効化

同様の質問が GitHub の Issue でもされています。

結論として、以下のコマンドでコンフィグを設定することで対応できます。

aspire config set features.defaultWatchEnabled true

実際に試したところ、レイアウト修正・C# コードの修正どちらもホットリロードされることを確認しました。

Aspire CLI の設定値一覧

aspire config set で設定できる項目は以下の通りです。

Setting Description 説明(AI翻訳)
appHostPath Path to default AppHost project. デフォルトの AppHost プロジェクトへのパス。
features.defaultWatchEnabled Enable watch mode by default for run command. run コマンドのデフォルトで watch モードを有効にする。
features.dotnetSdkInstallationEnabled Enable automatic .NET SDK installation. .NET SDK の自動インストールを有効にする。
features.execCommandEnabled Enable exec command. exec コマンドを有効にする。
features.minimumSdkCheckEnabled Enforce minimum SDK version. 最低 SDK バージョンを強制する。
features.orphanDetectionWithTimestampEnabled Use timestamp-based orphan detection. タイムスタンプベースの孤立プロセス検出を使用する。
features.packageSearchDiskCachingEnabled Cache package search results on disk. パッケージ検索結果をディスクにキャッシュする。
features.runningInstanceDetectionEnabled Enable detection of already running instances. 既に起動中のインスタンスの検出を有効にする。
features.showAllTemplates Show all templates including experimental ones. 試験的なものを含むすべてのテンプレートを表示する。
features.showDeprecatedPackages Show deprecated packages. 非推奨のパッケージを表示する。
features.stagingChannelEnabled Use staging channel packages. ステージングチャンネルのパッケージを使用する。
features.updateNotificationsEnabled Show update notifications. アップデート通知を表示する。

まとめ

Aspire CLIを用いて開発をしている際にdotnet watchのようなホットリロードを行うための設定を紹介しました。

他の設定だとfeatures.updateNotificationsEnabledとかも便利かもしれないです。

この記事が皆様のコーディングライフの助けになれば幸いです。

参考

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?