Previously I was able to publish to Azure Functions from Visual Studio but recently I always get an error saying that publish encountered an error. It directs to a log file the contents of which is as follows:
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__205.MoveNext()
(Inner Exception #0) System.Exception: Publishing failed.
System.Exception: Publishing failed.
I have tried the following:
- Reset publish profile in Azure, create a new profile in Visual Studio and try publish again. Still same error.
- Delete Function App in Azure and recreate it. Get new publish profile into Visual Studio and try publish again. Still same error.
- Upgrade Visual Studio 2019 to latest Version (16.2.5) and try publish again. Still same error.
Note that I have a Azure website in the same solution and I can still publish that to Azure.