私たちは主な製品ポートフォリオ(880プロジェクト以上)に20以上のソリューションを用意しています。私たちは、msbuildパイプラインからのnugetパッケージの復元を自動化しようとしています。現在のところ、これは、パッケージを復元するために手動でnugetに呼び出すことで行われます。MSBuildリストアターゲット - MSB4057:ターゲット "リストア"がプロジェクトに存在しません
https://docs.microsoft.com/en-us/nuget/schema/msbuild-targetsによると、私は、このコマンドを実行し、実行を復元持つことができるようになります。
# works
& $script:msBuildPath $solutionName /t:build /v:q /clp:ErrorsOnly /nologo /p:...
# doesn't works
& $script:msBuildPath $solutionName /t:restore,build /v:q /clp:ErrorsOnly /nologo /p:...
しかし、それは
MSB4057: The target "restore" does not exist in the project
エラーがスローされます上記の私がrestore,
を追加するときこのターゲットを見つけることができない理由を理解するために、どこから調査を始めますか?私たちは主にVS 2015と.NET 4.6.2を使用していますので、VS2017に固有のものは現時点では私の選択肢ではありません。
私はこの(少し消毒ソリューション/プロジェクト名とパス)を得るか/v:q
と/clp:ErrorsOnly
フラグを省略した場合
PS Z:\git\company> build c
building Common\Common.sln
Build started 11/15/2017 11:08:54 AM.
1>Project "Z:\git\company\Common\Common.sln" on node 1 (restore;build target(s)).
1>ValidateSolutionConfiguration:
Building solution configuration "DEBUG|Any CPU".
1>Z:\git\company\Common\Common.sln.metaproj : error MSB4057: The target "restore" does not exist in the project. [Z:\git\company\Common\Common.sln]
1>Done Building Project "Z:\git\company\Common\Common.sln" (restore;build target(s)) -- FAILED.
Build FAILED.
"Z:\git\company\Common\Common.sln" (restore;build target) (1) ->
Z:\git\company\Common\Common.sln.metaproj : error MSB4057: The target "restore" does not exist in the project. [Z:\git\company\Common\Common.sln]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.03
runBuildPackage : ... failed
At Z:\git\company\psincludes\buildFunctions.ps1:11 char:5
+ runBuildPackage "Common\Common.sln"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,runBuildPackage
msbuild failed
At Z:\git\company\psincludes\buildInternals.ps1:63 char:21
+ throw "msbuild failed";
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (msbuild failed:String) [], RuntimeException
+ FullyQualifiedErrorId : msbuild failed
私はこの周りのいくつかは、社内ツールであると認識、私はちょうどその部分をあいまいにする必要性を感じなかった。
「インターネット」によると、これはビルドプロセスの一環として「フリー」でなければならず、ここではcsprojファイルには何がないのか分かりません。
これを確認するには、VS2015を使用して復元機能を使用する唯一の方法は、これを手動で 'nuget restore'で実行することです。申し訳ありませんが、これは明らかですが、私はまだ少しぼやけているので、確かにしっかりしています。再度、感謝します! – jcolebrand
。 (私はドキュメントの現在の状態を考慮してあなたの混乱を完全に理解しています) –