Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy a self-contained .NET Core application with Azure DevOps App Service Deploy task

From a local machine I can publish a .NET Core application to Azure Web Service as a self-hosted application by defining <SelfContained>true</SelfContained> in publish profile.

App Service Deploy task in Azure DevOps pipeline publishes it to IIS by default. How configure it to publish as self-hosted?

like image 328
AsValeO Avatar asked Mar 17 '19 11:03

AsValeO


People also ask

How do I deploy app Services in Azure DevOps?

Azure Subscription. (Required) Select the service connection type to use to deploy the Web App. (Required if ConnectionType = AzureRM) Select the Azure Resource Manager subscription for the deployment. (Required if ConnectionType = PublishProfile) The path to the file containing the publishing information.


1 Answers

I got this working in Azure Dev Ops with my Blazor Server Side App that is targeting a preview version of .NET Core 3.0. To do this without creating a yaml file for your build definition you should be able to add the following argument on your dotnet publish task if you're not targeting a preview version of .NET Core.

-r win-x86 --self-contained true

The -r is the run time that you want to target, in my case I selected win-x86 since that is what my app service is configured to use. Then just add the self contained argument. Your full argument will probably look something like this:

--configuration $(BuildConfiguration) -r win-x86 --self-contained true --output $(build.artifactstagingdirectory)

This link covers the dotnet publish command. This is the same command that is executed when you publish from your local machine dotnet publish

The full list of run time identifiers can be found here: run time identfiers

gist of the complete build definition in yaml file yaml

like image 185
R007 Avatar answered Sep 23 '22 09:09

R007