zoukankan      html  css  js  c++  java
  • windows jenkins dotnet core 自动化构建webapi

    jenkins环境搭建好

    注意一下几点:

    - 需要安装git

    - 需要安装dotnet core sdk环境

    - 遇到这里报错,提示 Repository URL 错误的话,如果确实没有配置错误,重启一下机器试下

    [参考]

    与参考文章中不同之处在于,在最后一步增加了停止iis站点的命令,并且去掉了远程的相关指令,因为是本机发布。将相关代码贴到下边,建议手动敲一遍加深记忆。至于为什么要用这两种shell,我还不太清楚。

     Execute Windows batch command

    dotnet restore "%WORKSPACE%"
    dotnet build "%WORKSPACE%"
    dotnet publish "%WORKSPACE%srcxxxxxx.Mvc.csproj" -o c:Jenkins_Publishstrangerweb
    

    Windows PowerShell

    Write-Host '递归拷贝文件(强制覆盖模式)...'
    $files = Get-ChildItem -Path "C:Jenkins_Publishstrangerweb" # 获取本地目录的文件
    C:WindowsSystem32inetsrvappcmd.exe stop site "xxxx" # 暂停站点
    C:WindowsSystem32inetsrvappcmd.exe stop apppool /apppool.name:"xxxxx" # 启动应用程序池 foreach($file in $files){ Copy-Item -Path $file.FullName -Destination 'C:moqiwebsitexxx' -Include "*" -Recurse -Force Write-Host ‘复制文件开始’ $file.FullName } Write-Host '目录拷贝完成!'
    C:WindowsSystem32inetsrvappcmd.exe start apppool /apppool.name:"xxxxx" # 启动应用程序池

    C:WindowsSystem32inetsrvappcmd.exe start site "xxxx" # 启动站点

      

  • 相关阅读:
    Codeforces 960B(优先队列)
    “景驰科技杯”2018年华南理工大学程序设计竞赛 H-对称与反对称(逆元)
    AcWing
    POJ
    POJ
    AtCoder
    HRBUST
    CodeForces
    HYSBZ
    HDU
  • 原文地址:https://www.cnblogs.com/zinan/p/10900750.html
Copyright © 2011-2022 走看看