0

I am trying to publish an azure webjob from the command line but it does not actually deploy to azure.

I am able to successfully publish using Visual Studio 2019 using the Publish... option. VS2019 builds, publishes and deploys.

My command line attempt seems to build and publish, but no deploy.

The command line I am using is:

dotnet.exe publish Events.WebJob.csproj --verbosity n /p:PublishProfile="hssedapi-dev-webdeploy" /p:Password="${apipwd}" /p:UseAppHost=true

dotnet --version returns "2.2.202"

I found "Develop and deploy WebJobs using Visual Studio - Azure App Service" which is fairly current. It has a link to "Enabling Command-line or Continuous Delivery of Azure WebJobs" but it is from 2014.

user1282345
  • 251
  • 3
  • 6

1 Answers1

-1

The following Publish methods are currently supported by the Publish package:

·Folder Publish
·MsDeploy Publish
·MsDeploy Package Publish

According to the code you provided, you use the MsDeploy Publish. Profile can be added to the following location in the project /Properties/PublishProfiles/<MsDeployProfile.pubxml>. Here is sample MsDeploy Publish Profile:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <PublishProvider>AzureWebSite</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://webappwithdb.azurewebsites.net</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <MSDeployServiceURL>webappwithdb.scm.azurewebsites.net:443</MSDeployServiceURL>
    <DeployIisAppPath>webappwithdb</DeployIisAppPath>
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>$vramakwebappwithdb</UserName>
    <Password>DeployPassword</Password>
  </PropertyGroup>
</Project>
Joey Cai
  • 18,968
  • 1
  • 20
  • 30
  • The OP already knew this as it is created when you right click on your webjobs project and select publish as Azure webjobs then this MsDeployProfile.pubxml will be auto created by VS. However, the OP and myself need to know how to do this from commandline with MSBUILD.exe. – SmoothyBoothy Oct 25 '19 at 01:13