Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
428 stars 182 forks source link

Worker Extensions Internal Project Build Failure With Dependency Downgrade issue NU1605, while building Azure Functions DotNet 8 Isolated Model #2644

Open adarsh0raj opened 2 months ago

adarsh0raj commented 2 months ago

Description

Hi,

Latest Versions Used -

 <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.1" />
 <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />

Issue Description - While building the project through Azure Devops YAML pipeline, the build is failing on restoring internal WorkerExtensions project with NU1605 error. Since we don't have control over modules required for WorkerExtensions project, our Azure Functions .NET8 Project is resulting in Build Failure.

Error Logs:

##[error]src\<Repo Name>\obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj(0,0): Error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Configuration from 3.0.0 to 2.1.1. Reference the package directly from the project to select a different version. 
 Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.3.0 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Logging 3.0.0 -> Microsoft.Extensions.Configuration.Binder 3.0.0 -> Microsoft.Extensions.Configuration (>= 3.0.0) 
 Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.3.0 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Configuration (>= 2.1.1)

C:\__w\1\s\src\<Repo Name>\obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Configuration from 3.0.0 to 2.1.1. Reference the package directly from the project to select a different version. 
C:\__w\1\s\src\<Repo Name>\obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj : error NU1605:  Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.3.0 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Logging 3.0.0 -> Microsoft.Extensions.Configuration.Binder 3.0.0 -> Microsoft.Extensions.Configuration (>= 3.0.0) 
C:\__w\1\s\src\<Repo Name>\obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj : error NU1605:  Microsoft.Azure.Functions.Worker.Extensions -> Microsoft.NET.Sdk.Functions 4.3.0 -> Microsoft.Azure.WebJobs 3.0.32 -> Microsoft.Extensions.Configuration (>= 2.1.1)
  Failed to restore C:\__w\1\s\src\<Repo Name>\obj\Debug\net8.0\WorkerExtensions\WorkerExtensions.csproj (in 10.72 sec).

Build FAILED.

YAML Steps Used: {6F938794-1ED8-4EBE-A7BE-DC5D81227D4B}

Steps to reproduce

Steps To Repro:

Create an Azure Devops YAML Pipeline with above steps and try to run a Azure Functions Isolated .NEt 8 project. Getting these errors in Pipeline Logs, which is an internal dependency bad resolution resulting in NU1605 error and build failure.

mattchenderson commented 2 months ago

Interesting. Just noting that Microsoft.Azure.WebJobs 3.0.32 indeed references Microsoft.Extensions.Logging, but it should be version 2.1.1. See https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.32#dependencies-body-tab

I'm not sure why that's showing as 3.0.0 in your dependency trace there, and bringing in the conflicting deeper dependency.

It also occurs to me that this is a much older version of WebJobs (and Microsoft.NET.Sdk.Functions) than I would expect.

mattchenderson commented 2 months ago

@adarsh0raj would you be able to share any included extensions and their versions as well? Also, are you able to successfully build the project locally?

adarsh0raj commented 2 months ago

@mattchenderson Yes I am able to build the project locally fine. Also the Worker Extensions project generated locally is also building successfully and as expected.

Sharing the modules and their versions which are in csproj file:

 <ItemGroup>
   <FrameworkReference Include="Microsoft.AspNetCore.App" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.1" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
   <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.0" />
   <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
   <PackageReference Include="Azure.Identity" Version="1.12.0" />
   <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
   <PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.2.0" />
   <PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.41" />
   <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
   <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
   <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
   <PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.7" />
   <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
   <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
   <PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
   <PackageReference Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
   <PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
   <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.1" />
 </ItemGroup>
magj28 commented 1 month ago

any update on this? facing the same issue, unsure why its picking up Microsoft.Extensions.Configuration.Binder 3.0.0 even though it shows Microsoft.Extensions.Configuration.Binder 2.1.1 in the dependencies tab