Azure / azure-functions-dapr-extension

Extension for interacting with Dapr APIs from an Azure Function
MIT License
95 stars 33 forks source link

Azure Function using Dapr Topic Trigger (or Dapr output binding) Won't Build #188

Open bstone2032 opened 4 months ago

bstone2032 commented 4 months ago

When trying to create an azure function project in Visual Studio that uses the Dapr Topic trigger (or Dapr output binding), the project cannot be built due to reference of a nuget pkg with version greater than or equal to 99.99.99 in a temporary project that gets built automatically. Since the nuget pkg doesn't exist, the build fails. I am aware of the workaround mentioned here: https://github.com/Azure/azure-functions-dapr-extension/blob/master/troubleshooting-guide.md#unable-to-find-package-microsoftazurewebjobsextensionsdapr-with-version-999999

However, since we're looking to use this trigger in a production environment, this workaround isn't suitable for us. I had opened a support ticket through Microsoft already and I was advised to open an issue here as well so the progress on fixing it can be tracked.

System info: Microsoft Visual Studio Enterprise 2022 Version 17.8.6 VisualStudio.17.Release/17.8.6+34525.116 Microsoft .NET Framework Version 4.8.09037

Installed Version: Enterprise

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 17.8.358.6298 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.8.358.6298 Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio 2.6.5000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 17.8.358.6298 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.5000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Azure Hive Query Language Service 2.6.5000.0 Language service for Hive query

Microsoft Azure Stream Analytics Language Service 2.6.5000.0 Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.8.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.8.3.2405201+d135dd8d2ec1c2fbdee220e8656b308694e17a4b Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.8.120.1 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 17.0.20920.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

Steps to reproduce: 1) Create a new Azure Functions project using the “Azure Functions” project template. 2) Enter project name/location/solution name 3) Select .NET 8.0 Isolated (Long Term Support) for “Functions worker” dropdown, Dapr Topic Trigger for “Function” dropdown and ensure boxes are checked for “Use Azurite for runtime storage account (AzureWebJobsStorage)” and “Enable Docker” 4) Attempt to build solution. Notice that the project build fails with following error: "Unable to find package Microsoft.Azure.WebJobs.Extensions.Dapr with version (>= 99.99.99)

Note this same issue also occurs when you try to use a Dapr output binding.

AzzA-D commented 1 month ago

Any update on this? Our Docker build also fails with the error "Unable to find package Microsoft.Azure.WebJobs.Extensions.Dapr with version (>= 99.99.99)" after upgrading from .net 6 to .net 8 isolated.

tdorey00 commented 1 month ago

This seems to still be occurring with the 1.0.0 version released on March 15th, 2024.

ASHIQUEMD commented 1 month ago

Hi @AzzA-D,

To unblock you, I have created a sample .NET isolated Azure Function with Dapr extension that you can follow. Or please follow the steps below:

  1. Create a local-packages Folder:

  2. Create nuget.config:

    • In the root directory of your project, create a nuget.config file with the following contents:
      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
      <packageSources>
       <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
       <add key="nuget.local" value="local-packages" />
      </packageSources>
      </configuration>
  3. Include nuget.config and local-packages in the Docker Container:

    • Ensure you copy the nuget.config and local-packages into the Docker container. Here is an example from the Dockerfile:
      dotnet publish *.csproj --configfile nuget.config --output /home/site/wwwroot

By following these steps, you should be able to successfully build the Docker image. If you have any further questions or run into any issues, please feel free to reach out.

tdorey00 commented 1 month ago

Hi @ASHIQUEMD , are there any plans to create a fix for this issue/work around when using .NET 8 isolated or is this the way we are expected to configure those projects in perpetuity?

ASHIQUEMD commented 4 weeks ago

@tdorey00, we do have plans to fix this.