• Jenkins 自动化部署asp.net


    使用步骤

    1、安装jenkins、git和vs,并确保机器上安装了.net framework 4.5和.net framework4.0 ,完成后访问http://localhost:8080。

    2、进入插件管理,安装MSBuild Plugin、Git plugin两个插件。将开发机上的C:Program Files (x86)MSBuild文件夹直接拷贝到编译机上。

    选中“可选插件”页签,然后在过滤栏输入对应的插件名称,查到所需的插件后,直接点击安装即可。

    安装完成之后,在已安装页签里面就能够看到安装了的插件,记得安装完插件之后,要重启一下Jenkins。

    CMD——services.msc,重启Jenkins服务

    3、进入系统设置添加MSBuild和Git配置,如下图

    4、新增一个项目,选择构建一个自由风格的软件项目。

    5、配置git信息

    6、增加构建步骤,并选择Build a Visual Studio project or solution using MSBuild,

    7还原 NuGet 程序包

    我们需要在“构建”一栏中,新增一个“Execute Windows batch command”(执行批处理命令)步骤,用来进行 NuGet 包还原,下载

    NuGet x86 Commandline https://dist.nuget.org/index.html
    1 "F:Jenkins
    uget.exe" restore "F:JenkinsworkspaceMSDBbing.sln"

    首先是指定 nuget.exe 的路径,然后使用 restore 命令,对当前目录下的 YourSolutionName.sln 解决方案文件进行包还原。大家根据自己实际情况进行修改即可。

    8配置 MSBuild 编译参数

    依然是在“构建”一栏,新建一个“Build a Visual Studio project or solution using MSBuild”(使用 MSBuild 生成 VS 项目或解决方案)步骤

    从上往下,依次是

    • 选用的 MSBuild 版本
    • 目标项目或解决方案文件的路径+文件名
    • MSBuild 参数

    这里主要讲一下“Command Line Arguments”的配置,更全面的 MSBuild 文档可以参阅 MSDN:https://msdn.microsoft.com/zh-CN/library/dd393574.aspx

    我希望生成一个 ASP.NET MVC 项目,并发布到文件系统中,主要用到:

    • /t:Rebuild 重新生成
    • /p:Configuration=Release Release 生成模式
    • /p:VisualStudioVersion=14.0 指定子工具集(https://msdn.microsoft.com/zh-cn/library/bb383796.aspx)版本,不设置会报错
    • /p:DeployOnBuild=True;PublishProfile=Testing-Environment-CI-publish 使用 Testing-Environment-CI-publish.pubxml 发布文件来发布项目

    9发布本地项目

    其中WebProjectOutputDir是web站点的发布路径;OutputPath是编译输出的dll路径

  • 相关阅读:
    浅谈Java并发编程系列(八)—— LockSupport原理剖析
    mac上安装MongoDB
    在Mac上搭建Python虚拟环境
    Django项目上传到AWS服务器上
    Django部署
    Getting Started with Django Rest Framework and AngularJS
    Tutorial 7: Schemas & client libraries
    Tutorial 6: ViewSets & Routers
    Tutorial 5: Relationships & Hyperlinked APIs
    Tutorial 4: Authentication & Permissions
  • 原文地址:https://www.cnblogs.com/chenyishi/p/9351518.html
Copyright © 2020-2023  润新知