우리는 주 제품 포트폴리오 (880 개가 넘는 프로젝트)에서 20 개가 넘는 솔루션을 가지고 있으며, 잘 작동하는 복잡한 빌드 스크립트 세트를 가지고 있습니다. 우리는 msbuild 파이프 라인에서 nuget 패키지를 자동으로 복원하려고합니다. 현재이 작업은 패키지를 복원하기 위해 수동 호출을 통해 수행됩니다.MSBuild 복원 대상 - MSB4057 : 대상 "복원"이 프로젝트에 없습니다.
는 https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets에 따르면 내가이 명령을 실행할 수 및 복원 실행해야한다 : 나는 위의에 restore,
를 추가 할 때
# 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
에게 던졌습니다 이 대상을 찾을 수없는 이유를 이해하기 위해 조사를 어디에서 시작해야합니까? 우리는 주로 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
. (나는 문서의 현재 상태를 고려하여 혼란을 완전히 이해합니다) –