i would like to upgrade my azure function from net 6 to net 8.
here the initial csproj before upgrading.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<UseNETCoreGenerator>true</UseNETCoreGenerator>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.4.4" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.2.2" />
<PackageReference Include="Microsoft.Azure.DataLake.Store" Version="1.1.21" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.36" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.4.1" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="SSH.NET" Version="2016.1.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>
What I’ve Done So Far: Updated the project file for .NET 8: Here's my .csproj file after upgrading: ( cleaning, restoring, rebuilding, etc)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Classes\DataLakeGen1Helper.cs" />
</ItemGroup>
<ItemGroup>
<!-- Azure Packages -->
<PackageReference Include="Azure.Core" Version="1.44.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.7.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<!-- Azure Functions & Durable Task -->
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.41" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
<!-- Utility Libraries -->
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
no deployment error, and no build error.
but when running the function i get the following error message :
{"Message":"Something went wrong while processing your request","ExceptionMessage":"Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.","ExceptionType":"System.IO.FileNotFoundException","StackTrace":" at Azure.RequestFailedException.AppendContentAndHeaders(Response response, StringBuilder messageBuilder)\r\n at Azure.RequestFailedException.CreateExceptionDetails(Response response, RequestFailedDetailsParser parser)\r\n at Azure.RequestFailedException..ctor(Response response, Exception innerException, RequestFailedDetailsParser detailsParser)\r\n at Azure.Storage.Blobs.ContainerRestClient.CreateAsync(Nullable
1 timeout, IDictionary
2 metadata, Nullable1 access, String defaultEncryptionScope, Nullable
1 preventEncryptionScopeOverride, CancellationToken cancellationToken)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType, IDictionary2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken, String operationName)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsInternal(PublicAccessType publicAccessType, IDictionary
2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsAsync(PublicAccessType publicAccessType, IDictionary2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, CancellationToken cancellationToken)\r\n at DurableTask.AzureStorage.Storage.ClientResponseExtensions.DecorateFailure[T](Task
1 responseTask)\r\n at DurableTask.AzureStorage.Storage.BlobContainer.CreateIfNotExistsAsync(CancellationToken cancellationToken) in //src/DurableTask.AzureStorage/Storage/BlobContainer.cs:line 51\r\n
at DurableTask.AzureStorage.Partitioning.AppLeaseManager.CreateContainerIfNotExistsAsync() in //src/DurableTask.AzureStorage/Partitioning/AppLeaseManager.cs:line 207\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetTaskHubCreatorTask() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 371\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.EnsureTaskHubAsync() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 352\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetOrchestrationStateAsync(String instanceId, Boolean allExecutions, Boolean fetchInput) in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 1827\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.AzureStorageDurabilityProvider.GetOrchestrationStateWithInputsAsync(String instanceId, Boolean showInput) in //src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProvider.cs:line 81\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableClient.Microsoft.Azure.WebJobs.Extensions.DurableTask.IDurableOrchestrationClient.GetStatusAsync(String instanceId, Boolean showHistory, Boolean showHistoryOutput, Boolean showInput) in //src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs:line 465\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleGetStatusRequestAsync(HttpRequestMessage request, String instanceId, Nullable`1 returnInternalServerErrorOnFailure, IDurableOrchestrationClient existingClient) in //src/WebJobs.Extensions.DurableTask/HttpApiHandler.cs:line 635\r\n
at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleRequestAsync(HttpRequestMessage request) in /_/src/WebJobs.Extensions.DurableTask/HttpApiHandler.cs:line 376"}
so i went down the rabbit hole and tried different things in that direction.(some other questions here)
Attempted to manually reference System.Memory.Data: I added a direct for the System.Memory.Data assembly and ensured it is present in the bin\Debug\net8.0 folder.
I ran dotnet clean, dotnet restore, and dotnet build several times.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<!-- Generates runtimeconfig.json -->
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Classes\DataLakeGen1Helper.cs" />
</ItemGroup>
<ItemGroup>
<!-- Azure Packages -->
<PackageReference Include="Azure.Core" Version="1.44.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.7.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<!-- Azure Functions & Durable Task -->
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.41" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
<!-- Utility Libraries -->
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="System.Memory.Data" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\web.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Memory.Data">
<HintPath>bin\Debug\net8.0\System.Memory.Data.dllSystem.Memory.Data.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Project>
but i still get the same error.
I'm kind a noob in dot, glad to explore any other lead or suggestion you may have. You help would be very much appreciated
i would like to upgrade my azure function from net 6 to net 8.
here the initial csproj before upgrading.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<UseNETCoreGenerator>true</UseNETCoreGenerator>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.4.4" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.2.2" />
<PackageReference Include="Microsoft.Azure.DataLake.Store" Version="1.1.21" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.36" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.4.1" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
<PackageReference Include="SSH.NET" Version="2016.1.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>
What I’ve Done So Far: Updated the project file for .NET 8: Here's my .csproj file after upgrading: ( cleaning, restoring, rebuilding, etc)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Classes\DataLakeGen1Helper.cs" />
</ItemGroup>
<ItemGroup>
<!-- Azure Packages -->
<PackageReference Include="Azure.Core" Version="1.44.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.7.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<!-- Azure Functions & Durable Task -->
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.41" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
<!-- Utility Libraries -->
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
no deployment error, and no build error.
but when running the function i get the following error message :
{"Message":"Something went wrong while processing your request","ExceptionMessage":"Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.","ExceptionType":"System.IO.FileNotFoundException","StackTrace":" at Azure.RequestFailedException.AppendContentAndHeaders(Response response, StringBuilder messageBuilder)\r\n at Azure.RequestFailedException.CreateExceptionDetails(Response response, RequestFailedDetailsParser parser)\r\n at Azure.RequestFailedException..ctor(Response response, Exception innerException, RequestFailedDetailsParser detailsParser)\r\n at Azure.Storage.Blobs.ContainerRestClient.CreateAsync(Nullable
1 timeout, IDictionary
2 metadata, Nullable1 access, String defaultEncryptionScope, Nullable
1 preventEncryptionScopeOverride, CancellationToken cancellationToken)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType, IDictionary2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken, String operationName)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsInternal(PublicAccessType publicAccessType, IDictionary
2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken)\r\n at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsAsync(PublicAccessType publicAccessType, IDictionary2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, CancellationToken cancellationToken)\r\n at DurableTask.AzureStorage.Storage.ClientResponseExtensions.DecorateFailure[T](Task
1 responseTask)\r\n at DurableTask.AzureStorage.Storage.BlobContainer.CreateIfNotExistsAsync(CancellationToken cancellationToken) in //src/DurableTask.AzureStorage/Storage/BlobContainer.cs:line 51\r\n
at DurableTask.AzureStorage.Partitioning.AppLeaseManager.CreateContainerIfNotExistsAsync() in //src/DurableTask.AzureStorage/Partitioning/AppLeaseManager.cs:line 207\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetTaskHubCreatorTask() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 371\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.EnsureTaskHubAsync() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 352\r\n at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetOrchestrationStateAsync(String instanceId, Boolean allExecutions, Boolean fetchInput) in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 1827\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.AzureStorageDurabilityProvider.GetOrchestrationStateWithInputsAsync(String instanceId, Boolean showInput) in //src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProvider.cs:line 81\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableClient.Microsoft.Azure.WebJobs.Extensions.DurableTask.IDurableOrchestrationClient.GetStatusAsync(String instanceId, Boolean showHistory, Boolean showHistoryOutput, Boolean showInput) in //src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs:line 465\r\n at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleGetStatusRequestAsync(HttpRequestMessage request, String instanceId, Nullable`1 returnInternalServerErrorOnFailure, IDurableOrchestrationClient existingClient) in //src/WebJobs.Extensions.DurableTask/HttpApiHandler.cs:line 635\r\n
at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.HandleRequestAsync(HttpRequestMessage request) in /_/src/WebJobs.Extensions.DurableTask/HttpApiHandler.cs:line 376"}
so i went down the rabbit hole and tried different things in that direction.(some other questions here)
Attempted to manually reference System.Memory.Data: I added a direct for the System.Memory.Data assembly and ensured it is present in the bin\Debug\net8.0 folder.
I ran dotnet clean, dotnet restore, and dotnet build several times.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<!-- Generates runtimeconfig.json -->
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Classes\DataLakeGen1Helper.cs" />
</ItemGroup>
<ItemGroup>
<!-- Azure Packages -->
<PackageReference Include="Azure.Core" Version="1.44.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.7.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<!-- Azure Functions & Durable Task -->
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Core" Version="3.0.41" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
<!-- Utility Libraries -->
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="System.Memory.Data" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\web.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Memory.Data">
<HintPath>bin\Debug\net8.0\System.Memory.Data.dllSystem.Memory.Data.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
</Project>
but i still get the same error.
I'm kind a noob in dot, glad to explore any other lead or suggestion you may have. You help would be very much appreciated
Share Improve this question edited Nov 21, 2024 at 14:10 OrganicMustard asked Nov 20, 2024 at 12:34 OrganicMustardOrganicMustard 1,4262 gold badges23 silver badges45 bronze badges 3- 1 Please share your function code? Are you using in-process or isolated function? – Ikhtesam Afrin Commented Nov 20, 2024 at 12:42
- hi, just shared the main file. i'm using in process – OrganicMustard Commented Nov 20, 2024 at 13:29
- 1 The move to .NET 8 probably means code changes for using Isolated Functions, ideally, so it's more than just changing package references. If the project only has a few tens of Functions, I'd say it's easier to create a brand new .NET 8 Isolated project and then re-create each Function body from scratch using the latest templates. That way, you'll naturally re-add the packages as part of that process. It's not the only way, but it's what I've found easiest. – Andrew B Commented Nov 20, 2024 at 19:55
2 Answers
Reset to default 2Instead of directly updating the .csproj from .NET 6 to .NET 8, its better to create a .NET 8 in-process durable function and then add your required code along with the necessary packages as suggested by @Andrew B in the comment.
The issue could be occurring due to the conflict between the versions.
Follow the steps below to create a default .NET 8 in-process durable function.
Once created, it will have the below packages in .csproj file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<RootNamespace>_79207235</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.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>
- Then, add your required packages in .csproj file.
You can try with this approach, if you are upgrading you function app to .Net 8 in-process model.
If you are running locally make sure that you have those environment variables available in your json file. The same applicable for the azure environment as well. Also make sure that you have updated your package references as well.