Resolve - Azure Function App Publish Specific Target Not Existing in VS2019

visibility 97 access_time 10 months ago languageEnglish

Problem statement

When following official tutorial Develop and publish .NET 5 functions using Azure Functions, the Specific target for Azure Function App doesn't exist in the wizard.

Environment: Visual Studio 2019 16.11.1 (the latest version).

Azure Tools: Included when installing Visual Studio.

.NET version: 5.0 (isolated).

Resolution

To fix this problem, simply add the following highlighted package reference (Microsoft.Azure.Functions.Workder.Sdk)  in your project file:

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net5.0</TargetFramework>
		<AzureFunctionsVersion>v3</AzureFunctionsVersion>
		<OutputType>Exe</OutputType>
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.5.1" />
		<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.4" />
		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="4.0.4" />
		<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
        </ItemGroup>
	<ItemGroup>
		<None Update="host.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
		</None>
		<None Update="local.settings.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<CopyToPublishDirectory>Never</CopyToPublishDirectory>
		</None>
	</ItemGroup>
</Project>
Rebuild after changing project file and then start Publish wizard. Azure Function App should then show up as the following screenshot shows:

Blob triggered function

For Blob triggered function template with .NET 5 in Visual Studio 2019, you will encounter compiler errors like could not find FunctionAttribute or BlobTriggerAttribtue class. The resolution is already provided in the above sample project file - add the right package references:

<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.5.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="4.0.4" />

Refer to .NET isolated process guide for .NET 5.0 in Azure Functions | Microsoft Docs for details.

warning At the moment, the Visual Studio 2019 support for .NET Azure Functions are not very user friendly thus it is important to add the package references accordingly.
info Last modified by Raymond 10 months ago copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

timeline Stats
Page index 0.36
More from Kontext
[Diagram] Azure Virtual Network Example image
visibility 77
thumb_up 0
access_time 5 months ago
Azure Virtual Network Example
[Diagram] Process Automation Approaches on Azure image
visibility 72
thumb_up 0
access_time 5 months ago
Process Automation Approaches on Azure
[Diagram] Azure Kubernetes Service Components image
visibility 51
thumb_up 0
access_time 6 months ago
Azure Kubernetes Service Components