Home > Blockchain >  A ddl mismatch issue after upgrading Azure Function app to Dotnet 6
A ddl mismatch issue after upgrading Azure Function app to Dotnet 6

Time:05-21

I've just upgraded an Azure function app from Dot Net Core v3.1 to Dot Net v6, including updating all the NuGet packages.

The solution compiles but when I run it I'm getting this error:

error CS1705: Assembly 'xxxxx' with identity 'xxxxx, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null' uses 'Microsoft.Azure.WebJobs.Host, Version=3.0.33.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than 
referenced assembly 'Microsoft.Azure.WebJobs.Host' 
with identity 'Microsoft.Azure.WebJobs.Host, Version=3.0.32.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I can't see any mismatched versions or dependencies. I've cleared the NuGet cache, I've deleted the bin directories and rebuilt.

Any suggestions?

CodePudding user response:

Yes! Probably, when you're upgrading the Azure Functions project from .NET Core 3.1 to .NET 6, you'll get this error. To fix this, you need to change the Azure Functions version to v4 in the .csproj file.

Also, Azure Functions Core Tools version 4 should be installed in the System to use Azure Functions .NET 6.

In a nutshell, some dependencies loaded in memory by Azure Functions SDK, so your libraries will be unable to use newer versions of the same libraries.

Few other steps were:

  • Check your NuGet Package Manager that Microsoft.NET.Sdk.Functions is having the correct version according to target framework given in this MSFT Doc.
  • Make Sure all the dll's are compiled against the correct versions.
  • Regarding the CS1705 error in .NET C#, refer here for more information like what would be the causes and fixes to this error - provided by Microsoft.
  • Related