Dotnetcore Cross-platform ~ Release Script PowerShell design

Source: Internet
Author: User
Tags dotnet

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.