Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Visual Studio 2022 NuGet パッケージをローカルキャッシュ化する方法

0
Posted at

はじめに

ソリューションをオフライン環境に持ち運んだとき NuGet の都合でビルドが通らなくて困ることがあるので、その対策の備忘録です。

改訂履歴

  • 2026/05/04 : 初版公開。

本文

1. 環境

  • .NET 8.0
  • Visual Studio Community 2022

2. 方法

以下が NuGet.config の内容です。使い方は sln ファイルと同階層に置くだけです。

NuGet.config
<!-- 本ファイルは sln ファイルと同階層に置いてください。 -->
<configuration>
  <config>
    <!--
      NuGet キャッシュをユーザーフォルダではなくプロジェクト内に保存する。
      環境依存を減らし、フォルダ単位で持ち運び可能にすることが目的(ポータブル性の優先)。
      ※初回のダウンロードはオンライン環境が必要、以降はキャッシュが優先して使用される。
    -->
    <add key="globalPackagesFolder" value=".\Packages" />
  </config>
</configuration>

3. 参考

おわりに

ポータブル性の向上と引き換えに、フォルダ全体のサイズは増えます。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?