Yagel
Yagel

Reputation: 1312

Dot net nuget restore - restore: invalid arguments error

I'm trying to compile my C# project using the restore command:

bat "nuget.exe restore \"C:(...)\\Bin\\msbuild.exe\" mycoolproj.sln \t:Clean,Build"

And I get restore: invalid arguments error.

Then I changed to /t:Clean,Build, and I get "Unknown option 't:Clean,Build'".

Do you know what is the problem?

Upvotes: 0

Views: 846

Answers (1)

Shleemypants
Shleemypants

Reputation: 2693

The /t:Clean,Build is a msbuild.exe switch and currently you can't pass switches to msbuild using nuget.exe. Alternatively because you're building your project you can tell msbuild.exe to restore those packages for you:

msbuild.exe solution.sln /t:rebuild,restore

Also in MSBuild 15.5 and later there is a /restore switch which is recommended:

msbuild.exe solution.sln /restore /t:rebuild

You can learn more about MSBuild CLI here and NuGet CLI here.

Upvotes: 3

Related Questions