powershell~ Publish your MVC site

Source: Internet
Author: User

You can easily compile your. NET application by using PS Plus MSBuild, and you can publish it to your disk and deploy a very good example!

We add a Hello website in C drive, the solution name is Hello.sln, its website is hello.csproj, now use this script to generate this website and publish this website!

$ErrorActionPreference ='Stop'# Environment Helpers------------------------------------Function Get-Msbuildpath () {$msBuildRegPath="hklm:\software\microsoft\msbuild\toolsversions\14.0"$msBuildPathRegItem= Get-itemproperty $msBuildRegPath-name"MSBuildToolsPath"$msBuildPath= $msBuildPathRegItem. MSBuildToolsPath +"MSBuild.exe"    return$msBuildPath}# Environment Variables----------------------------------$global _builddirpath= get-Location$global_msbuildpath= get-Msbuildpath$global_solutionpath="$global _builddirpath"$global _solutionfilepath="$global _solutionpath\hello.sln"$global _nugetpath="$global _builddirpath\tools\nuget.exe"# Install NuGet Packages---------------------------------Function Install-solutionpackages () {IEX"$global _nugetpath restore $global _solutionfilepath"}# compilefunction Compile-publish-Project () {IEX-command"& ' $global _msbuildpath ' $project _path '/p:configuration=release/p:webprojectoutputdir=c:\publish\hello/p : Outputpath=c:\publish\hello\bin"}install-Solutionpackagescompile-publish-project

The last generated site results are

This feature is very necessary for automated deployment, and uncle will do further research and optimization of this piece of content!

Thank you!

powershell~ Publish your MVC site

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.