编译环境: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还原包失败的情况。

如有此情况,在搜索并使用其它方案未果,排除其它原因(例如网络问题,被墙等),可以使用本解决方案试试。

在CI (Jenkins) 从机(服务器)上使用bat批处理执行自动构建任务时,输出NuGet还原失败的解决方案的更多相关文章

  1. Windows服务器上使用bat定时执行php

    windows上和linux上有一个类似的cmd和bat文件,bat文件类似于shell文件,执行这个bat文件,就相当于依次执行里面的命令(当然,还可以通过逻辑来实现编程),所以,我们可以利用bat ...

  2. 搭建服务器上的GIT并实现自动同步到站点目录(www)

    https://blog.csdn.net/baidu_30000217/article/details/51327289 前言:当我们想要实现几个小伙伴合作开发同一个项目,或者建立一个资源分享平台的 ...

  3. Jenkins在windows服务器上依赖的maven仓库目录

    1.在windows server 2008上,maven仓库路径为: C:\Users\用户名\.m2 2.在windows server 2003上(加入域的服务器),maven仓库路径为: C: ...

  4. jenkins在windows服务器上执行含git push命令的脚本权限不足的解决方法

    错误摘要 默认情况下执行脚本是没问题的,但是脚本中含有git push命令就无法执行了 用jenkins部署hexo博客时候遇到的,执行hexo d -g一直阻塞至Build was aborted, ...

  5. [Jenkins]怎样在Jenkins上面启动服务器上的批处理脚本

    New Item 在Build --> Execute Windows batch command --> 里面填写: schtasks /run /tn Start_Hub_szotqa ...

  6. 在从myql服务器上 取消主从关系和重新构建主从关系

    取消主从关系 mysql -uroot -p mysql>show slave status\G; 查看主库是否为之前的ip mysql>change master to master_h ...

  7. ubuntu服务器上提示 To run a command as administrator (user "root"), use "sudo <command>". See " 解决方案

    原因是你执行命令必须要在root用户下执行.其他用户权限不够.运行  sudo -s 切换到root用户下就可以了

  8. jenkins与gitlab集成,分支提交代码后自动构建任务(六)

    一.在gitlab中创建token 复制token,此token只显示一次:6SB8y4jt31NnYG5-nWoi 二.在gitlab上为项目创建trunk分支 三.在jenkins中配置gitla ...

  9. 基于Kubernetes/K8S构建Jenkins持续集成平台(上)-2

    基于Kubernetes/K8S构建Jenkins持续集成平台(上)-2 Kubernetes实现Master-Slave分布式构建方案 传统Jenkins的Master-Slave方案的缺陷 Mas ...

随机推荐

  1. was设置事务超时

    select Application servers ->server1 From the Configuration tab, expand Container Services under ...

  2. elasticsearch 6.1.1 transport jar

    https://files.cnblogs.com/files/xjyggd/transport6.1.1.rar

  3. link元素 rel src href属性

    The SRC and HREF attributes are used to include some external entities like an image, a CSS file, a ...

  4. 最强Android书 架构大剖析 作者网站

    http://newandroidbook.com/    jonathan levin   (最强Android书 架构大剖析) http://newandroidbook.com/AIvI-M-R ...

  5. A - The Water Problem

    In Land waterless, water is a very limited resource. People always fight for the biggest source of w ...

  6. vue2中使用 better-scroll

    使用时有三个要点: 一:html部分 <div class="example" ref="divScroll"> <div> <p ...

  7. eclipse解决js提示

    自学js,发现eclipse中不管js文件.html文件.jsp文件没有都没js代码的提示,对于js代码也不报错,有时候就因为单词敲错却查了很久没查出来,很烦很难受. 在网上找了很多方法,都没有解决, ...

  8. python 3 往Excel 中的写入内容但不覆盖原内容

    EXCEL 写入数据保持原样式 import xlwt import xlrd import xlutils import xlutils.copy class ExcelHandle(): def ...

  9. plsvo

    1 图像对齐 std::for_each(ref_frame->seg_fts_.begin(), ref_frame->seg_fts_.end(), [&](plsvo::Fe ...

  10. Elasticsearch学习笔记(二)Search API 与 Query DSL

    一. Search API eg: GET /mall/product/_search?q=name:productName&sort=price desc 特点:search的请求参数都是以 ...