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?

More than 1 year has passed since last update.

Nugetパッケージの復元エラーをコマンドライン環境下で解決する方法

Posted at

はじめに

Nuget を利用したソリューションを新規環境でビルドしようとすると、パッケージの復元エラーが発生することがある。
本書は、その解決方法の覚書である。

統合開発環境の場合

VisualStudioの統合開発環境でのビルドならば、

に説明された手順とおりに、

1.メインメニュー [ツール] > [NuGet パッケージ マネージャー] > [パッケージ マネージャー設定] でオプションダイアログを開く。
2. パッケージの復元 のチェックボックス2つをオンにして、OKをクリックする。
3. プロジェクトを再ビルドする。
image.png

これにてパッケージの復元が実行される。

コマンドライン環境の場合

Makefile や jenkinsなどのコマンドライン環境下のビルドならば、

に説明されているが、具体例に乏しくわかりにくい。
Makefile に記載する依存関係も含めて正解をここに記す。

# update packages folder
packages: packages.config
    msbuild /nologo /p:platform=x86 /p:configuration=Release /t:restore /p:RestorePackagesConfig=true MYPROJ.sln

これにて packages フォルダが無い場合や、packages.config変更時にパッケージの復元が実行される。
手動復元したい場合はコマンドラインに nmake packages と打ち込めば良い。

msbuild のかわりに nuget.exe を使う方法もあるが本書では割愛する。
nuget.exe を使う方法は下記リンクを参照されたい。

END

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?