问题
Currently we deploy our web application projects (csproj's) via a call to MSBuild.exe
with the DeployOnBuild=true
and PublishProfile=Whatever
parameters to deploy our projects to one of the following:
- IIS on premisis
- Azure Web Apps
- Web Deployment Packages
We'd like to begin using the new .net core rc2 projects, but we're really not sure how to deploy them. Can we use the older publish profiles / publish methods?
When going thru the Visual Studio Publishing UI, I only see File System
and Microsoft Azure App Service
as options. The File System doesn't make a web deployment package and we'd like to continue using the deployment package technique, especially for promoting the same build between different environments.
In general, any advice on deploying .net core rc2 apps via msbuild in a manner similar to what we previously did, would be fantastic. However, specifically, I'd like to know how to deploy .net core rc2 projects to web deployment packages via msbuild. Thanks for any advice!
回答1:
Just as a note: The tooling around .NET Core and ASP.NET Core is in "Preview 1" not finished yet and my proposed solution could change with the next version.
Anyway. msdeploy.exe is still working but needs some knowledge about the msdeploy CLI.
I just configured a continuous deployment process using FAKE (F# Make) but it should also work with MSBuild, if you have some deeper knowledge of it.
The first step is to use "dotnet publish" to deploy to a specific folder using arguments like this:
"dotnet publish " + webPath + " --framework net461 --output " + publishFolder +
" --configuration " + buildConf + " --no-build"
Than you need to call msdeploy.exe with arguments similar to this:
"msdeploy.exe -source:contentPath=" + publishFolder + " -dest:contentPath=" + targetFolder +
",ComputerName=" + computerName + ",UserName='" + username + "',Password='" + publishPassword +
"',IncludeAcls='False',AuthType='Basic' -verb:sync -enablerule:AppOffline -enableRule:DoNotDeleteRule -retryAttempts:20"
Visual Studio does exactly the same, if you publish to Azure. If you try it with Visual Studio, you'll see that in the publish output window.
回答2:
thx a lot! worked for me!
i have used:
$website = Get-AzureWebsite -Name [AzureWebsiteName]
# get the SCM URL to use with MSDeploy.
# by default this will be the second in the array.
$msDeployHost = $website.EnabledHostNames[1]
and then i've created the -dest:contentPath like this
$destPath="$($website.Name),ComputerName='https://$msDeployHost/msdeploy.axd',UserName='$($website.PublishingUsername)',Password='$($website.PublishingPassword)',IncludeAcls='False',AuthType='Basic'"
来源:https://stackoverflow.com/questions/37869701/how-do-i-deploy-net-core-rc2-projects-via-msbuild-msdeploy