0
votes

How can i deploy an Azure Function App V2 to an existing Linux Function App Plan in Azure from Visual Studio 2019?

When i select "Select existing" from the publish-dialog in Visual Studio i only see my windows-based functions in my connected Azure Subscription, but the Linux one i created in the same subscription is missing.

When i download the publishing profile for the function app, import this and try to publish this way, i get an error which is not very helpful imho:

System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__202.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---

System.Exception: Publishing failed.

What is the way to publish a C# Azure Function to a Azure Functions running on Linux?

1
I also cann't see linux app on Visual Studio when publish. Do you have to use Visual Studio to deploy? - Cindy Pau
You can use cmd - Cindy Pau
Have my solution solved your problem? - Cindy Pau
@BowmanZhu Thank you for your suggestion! I will try asap and report back. - Markus S.

1 Answers

3
votes

1.right click your project in Visual Studio. Select 'Open Floder in File Explorer'.

enter image description here

2.Press the win and R keys at the same time, then type "cmd" and click OK.

enter image description here

3.Go to the folder where the project is located.

enter image description here

4.Then use func azure functionapp publish <APP_NAME>.(each <APP_NAME> is unique on Azure. in myside, it's name is linuxFunctionAppBowman, you can use the name that you created before.)

enter image description here

5.Function been deployed.

enter image description here