文章出處
文章列表
編譯環境:Jenkins+MSBuilds
1.搜索本次構建的解決方案中的所有csproj后綴文件,打開后找到這一段代碼,并且刪除掉。如果沒有,直接忽略跳過。
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> ... </Target>
這里因為在Visual Studio 2015中(對應的MSbuild版本是V14.0),已不再需要這一段代碼配置。
2.增加命令:nuget.exe update -Self
echo Start initialize build parameters ::set DotNetFrameworkPath=%windir%\Microsoft.NET\Framework ::if exist %windir%\SysWOW64 set DotNetFrameworkPath=%windir%\Microsoft.NET\Framework64 set SolutionName=Uniqlo set Configuration=Debug set LogLevel=normal set SolutionPath=%~dp0..\src\ set SolutionFile=%SolutionPath%%SolutionName%.sln set NugetExe=%SolutionPath%.nuget\NuGet.exe set NugetArgs=restore "%SolutionFile%" set MSBuildPath=C:\Program Files (x86)\MSBuild\14.0\Bin set MSBuildExe=%MSBuildPath%\MSBuild.exe set MSBuildArgs=/t:Rebuild /p:Configuration=%Configuration%;VisualStudioVersion=14.0;TargetFrameworkVersion=4.6.1 /verbosity:%LogLevel% /l:FileLogger,Microsoft.Build.Engine;encoding=utf-8;append=true;logfile=build\%SolutionName%_%Configuration%_Build.log echo Initialize build parameters completed. echo NuGet Start ReStoreing... "%NugetExe%" update -Self "%NugetExe%" %NugetArgs% echo NuGet ReStore completed. echo MSBuild Start building... "%MSBuildExe%" %MSBuildArgs% "%SolutionFile%" echo MSBuild Build completed.
本解決方案同樣適用于在本地機器中使用VS2015編譯出現NuGet還原包失敗的情況。
如有此情況,在搜索并使用其它方案未果,排除其它原因(例如網絡問題,被墻等),可以使用本解決方案試試。
文章列表
全站熱搜