These days of PS love is loyal, by its powerful function of the Greek, it can be quickly deployed, quickly released, will be some joint action once completed, very convenient, similar to the early bat files, also like the Linux platform Bash script, but functionally, than the previous two are much stronger, Let's take a look at the process of publish all projects under a solution once, and we use the PS script.
# Storage Uncle # function: Publish the project to the specified place param ([string] $rootPath) $scriptPath= split-Path $script: MyInvocation.MyCommand.PathWrite-host"Current script directory is $scriptPath"-Foregroundcolor Yellowif([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 $projectPa Th-o $outPath}
Note: If you only send cross-platform projects to the Obj\publish folder, then wwwroot these folders will not be generated, and if sent to other disks, will generate these static files, this should pay attention!
Cross-platform project, need to add runtime in Project.json, otherwise your project can be run on the current platform
" runtimes " : { "win7-x64": {}, "linux-x64" : {}, "osx-x64": {} },
Thank you for your support for. NET Core!
Dotnetcore Cross-platform ~ Release Script PowerShell design