0
votes

I have a hard time to publish to azure website via command line. First of all I tried with VS generated powershell scripts which are getting generated inside .\Properties\PublishProfiles. I referred the answer in the post Publishing ASP.Net Core app to Azure silently fails in command line. I am able to pass only one parameter(which is password) as publish Properties. I tried to execute like below

PS D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\DotNetCoreWebApiSample\Properties\PublishProfiles> & '.\DotnetCoreWebApiSample - Web Deploy-publish' -pa
ckOutput 'D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\Output' -pubProfilePath 'DotnetCoreWebApiSample - Web Deploy.pubxml'-publishProperties @{'Passwor
d' = 'klk'} -verbose

The above attempt atleast trying to invoke msdeploy, but did not succeed. I got below output

Publishing with publish method [MSDeploy] Executing command ["C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:manifest='C:\Users\579859\AppData\Local\Temp\PublishTemp\obj\Output\SourceManifest.xml' -des t:manifest='C:\Users\579859\AppData\Local\Temp\PublishTemp\obj\Output\DestinationManifest.xml',ComputerName='https://dotnetcorewebapisample.scm.azurewebsites.net/msdeploy.axd?site =DotnetCoreWebApiSample',UserName='$DotnetCoreWebApiSample',Password='{PASSWORD-REMOVED-FROM-LOG}',IncludeAcls='False',AuthType='Basic' -verb:sync -enablerule:AppOffline -enableRu le:DoNotDeleteRule -retryAttempts:20] Info: Using ID '25f52554-53e4-4a74-8392-df82e2a07806' for connections to the remote server.

I am not sure what is wrong here. I also tried to pass multiple parameters like below, but some syntax error was reported by powershell.

 PS D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\DotNetCoreWebApiSample\Properties\PublishProfiles> & '.\DotnetCoreWebApiSample - Web Deploy-publish' -pa
    ckOutput 'D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\Output' -pubProfilePath 'DotnetCoreWebApiSample - Web Deploy.pubxml'-publishProperties @{'usernam
    e' = 'myusername' 'Password' = 'uL''AllowUntrustedCertificate' = false''AuthType' = 'Basic'} -verbose

Finally I tried to use Msdeploy directly like as below

@echo off
dotnet publish ".\DotNetCoreWebApiSample" --framework netcoreapp1.0 --output "D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\Output" --configuration Release
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:contentPath='D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\Output',-dest:contentPath='DotnetCoreWebApiSample',ComputerName='https://dotnetcorewebapisample.scm.azurewebsites.net/msdeploy.axd',UserName="myUser",Password="L",IncludeAcls="False",AuthType="Basic" -enablerule:AppOffline -enableRule:DoNotDeleteRule -retryAttempts:20 -verbose

Now I am getting the error "Error: A '-dest' argument must be specified with the 'sync' verb." I am totally clueless here. Please note that I have already provided -verb:sync and still msdeploy is complaining the same. can someone help me how to publish a .net core web app with command line to an azure web app. For msdeploy, I referred the post http://asp.net-hacker.rocks/2016/07/04/deploy-aspnetcore-to-azure.html. I am using sdk with version "1.0.0-preview2-003131".

1
Travis, I am using 1.0.1 and not RC1. Also I am trying to use dotnet publish. I am kind of clueless here why msdeploy fails with such weird errorSajan
Finally I was able to find out the issue with msdeploy. It was because of the comma present after -source:contentPath. Took lot of time to figure out.Sajan

1 Answers

0
votes

The -source attribute in your MSDeploy call has a comma at the end but no additional flags. Replace the comma before -dest with a space:

-source:contentPath='D:\Sajan\SampleApplications\ADNext\DotNETCore\DotNetCoreWebApiSample\src\Output' -dest:contentPath='D