2017-06-13 14 views
2

いくつかのプロジェクトのナゲットリファレンスをコマンドラインから更新しようとしています。これらのプロジェクトは、PackageReference要素を含む新しい形式を使用します。私が使っているコマンドは次のとおりです。新しいcsproj形式のnuget.exeアップデート

nuget.exe update someproj.csproj 

これはエラーになり:

The default XML namespace of the project must be the MSBuild XML namespace. 
If the project is authored in the MSBuild 2003 format, please add 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> 
element. If the project has been authored in the old 1.0 or 1.2 format, 
please convert it to MSBuild 2003 format. 

は、コマンドラインからパッケージをnuget.exeを使用するか、または更新するdotnet.exeするためにいくつかの方法はありますか?

+0

あなたはどのバージョンのnuget.exeをお持ちですか? –

+0

nuget v 3.4.4.1321 – user653649

答えて

2

新しいcsproj形式で作業するには、nuget.exeのバージョンが4以上必要です。

あなたはまだ古いスタイルpackages.configを使用する必要がありますまたはあなたがこれらを実行することができます

Update-Package 

のPowerShellコマンドレットを使用することができるかもしれませんが、次の出力

C:\dev>nuget.exe update test.csproj 
MSBuild auto-detection: using msbuild version '15.1.548.43366' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'. 
Unable to update. The project does not contain a packages.config file. 

になりますがパッケージマネージャコンソール(https://docs.microsoft.com/en-us/nuget/tools/package-manager-console)から削除します。

また、ちょうどこの上で次の

Import-Module PackageManagement.Cmdlets.dll 

Set-Project MySolution "MySolution.sln" 

Update-Package 

の詳細は、このブログで見つけることができるのPowerShellモジュールにロードして実行することができます - 現時点でhttp://community.sharpdevelop.net/blogs/mattward/archive/2011/06/12/InstallingNuGetPackagesOutsideVisualStudio.aspx

+0

このコマンドはパッケージを復元すると私は理解しています。パッケージ参照を最新のものに更新したい。 – user653649

+0

私の間違い申し訳ありませんが、PowerShellの 'Update-Package'を使って試してみてはいかがですか –

+0

私はpowershellからupdate-packageを使うことを考えましたが、それを含むスクリプトは見つかりませんでした。もう少し詳しく説明できますか? – user653649

2

、これが不可能です。追跡については、this GitHub issueを参照してください。

しかし、参照を追加するためのcliコマンドは、dotnet add package The.Package.Idを再実行して、プロジェクト内の単一パッケージの更新をサポートします。

関連する問題