• Jenkins + PowerShell + .net core 自动打包


    注意,IIS路径一定要用 ,不能用 /

    https://blog.csdn.net/aixian3620/article/details/102205138

    echo "======solution dircectory======";
    ls;
    
    echo "======building version======";
    $versionDate=Get-Date -Format 'yyyyMMddHHmmss';
    echo "v$versionDate";
    
    $iisSiteName="hoawebapis";
    $sourceBuildPath="H:devopshoawebapiv$versionDateuild";
    $sourcePublishPath="H:devopshoawebapiv$versionDatepublish";
    
    echo "======begin restore packages======";
    dotnet restore "Hoa.Web.Host/Hoa.Web.Host.csproj" -s "https://api.nuget.org/v3/index.json" -s "https://www.myget.org/F/miniprofiler/api/v3/index.json";
    echo "======restore success======";
    
    echo "======begin build code source======";
    dotnet build "Hoa.Web.Host/Hoa.Web.Host.csproj" -c Release -o $sourceBuildPath;
    echo "======build success======";
    
    echo "======begin publish code source======";
    dotnet publish "Hoa.Web.Host/Hoa.Web.Host.csproj" -c Release -o $sourcePublishPath;
    echo "======publish success======";
    
    echo "======begin set asp.net core environment======";
    [Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Staging", "Machine")
    echo "======set success======";
    
    echo "======go to publish direcctory======";
    pushd $sourcePublishPath;
    
    echo "======change appsetting.json======";
    Remove-Item ./appsettings.json -Recurse;
    Rename-Item ./appsettings.Staging.json appsettings.json;
    echo "======change success======";
    
    pushd C:WINDOWSsystem32inetsrv;
    
    echo "======change iis dir======";
    ./appcmd set vdir "$iisSiteName/" -physicalPath:$sourcePublishPath;
    echo "======change success======";
    
    echo "======restart iis site======";
    ./appcmd stop site $iisSiteName;
    ./appcmd start site $iisSiteName;
    echo "======restart success======";
    
    echo "The Application is running......";
    
  • 相关阅读:
    Codeforces Round #336 B
    Codeforces Round #336 A
    hiho一下157
    Codeforces Round #420 E
    Codeforces Round #420 C
    Codeforces Round #420 B
    Codeforces Round #420 A
    Codeforces Round #418 C
    Codeforces Round #418 B
    CodeForces 811D Vladik and Favorite Game bfs,模拟
  • 原文地址:https://www.cnblogs.com/baiqian/p/13051563.html
Copyright © 2020-2023  润新知