留神:借使你只是把跨平台项目发到obj\publish文件夹的话,那wwwroot这几个文件夹不会扭转,而借使发到其余磁盘,将会转移那些静态的文本,那一点要留意!

回去目录

这几天对PS情有独忠,被它的无敌效用所希引,它能够快捷安顿,快捷发表,将部分有关的动作1遍的形成,挺方便,类似于前期的bat文件,也像linux平台的bash脚本,但意义上,比前两者都要强很多,上边大家看一下将有个别消除方案下的保有连串一遍publish的进度,大家利用ps脚本来实现的。

  "runtimes": {
    "win7-x64": {},
    "linux-x64": {},
    "osx-x64": {}
  },

跨平台项目,须求在project.json里把运转时都丰富,不然你的档次保能在近期平台运转

多谢各位对.net core的支撑!

回来目录

# 作者:仓储大叔
# 功能:发布项目到指定的地方
Param([string] $rootPath)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path

Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow

if ([string]::IsNullOrEmpty($rootPath)) {
    $rootPath = "$scriptPath\.."
}
Write-Host "Root path used is $rootPath" -ForegroundColor Yellow

$projectPaths = 
    @{Path="$rootPath\src\LindCore.Manager";Prj="LindCore.Manager.csproj";Name="web"},
    @{Path="$rootPath\src\LindCore.Test";Prj="LindCore.Test.csproj";Name="console"}

$projectPaths | foreach {
    $projectPath = $_.Path
    $projectFile = $_.Prj
    $name=$_.Name
    # $outPath = $_.Path + "\obj\publish"
    $outPath = "d:\publish\"+$name
    $projectPathAndFile = "$projectPath\$projectFile"
    Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow
    remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue
    Write-Host "Publishing $projectPath to $outPath" -ForegroundColor Yellow
    dotnet restore $projectPathAndFile
    dotnet build $projectPath
    dotnet publish $projectPath -o $outPath
}

相关文章

网站地图xml地图