Reputation: 11
I have the following situation. I am trying to write an Azure function in C#.Net that will read from a Storage Queue (using a trigger), and then look up an entity within an Azure Storage Table.
To create the function I have used Visual Studio 2017 and have created a functions project. The following reference is in the csproj file.
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.2" />
Then I follow the instructions on how to read, write and query tables as described here. https://learn.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-dotnet
However, when I add go to install one of the required dependencies such as Install-Package Microsoft.Azure.Storage.Common -Version 9.0.0.1-preview I am unable to as there is a conflict between the version of Newtonsoft.Json I need for the Microsoft.NET.Sdk.Functions dependencies as it can only use 9.0.1.
Does anyone know of a solution to resolve this?
Upvotes: 0
Views: 691
Reputation: 1682
Try using azure timer function and use class library reference. In class library you can use your latest blob storage version so it will not have dependency on Newtonsoft.Json, and you can write your code in library call it from function. Something like this https://blogs.msdn.microsoft.com/benjaminperkins/2017/04/13/how-to-add-assembly-references-to-an-azure-function-app/
Upvotes: 0
Reputation: 20067
As you said, the Microsoft.NET.Sdk.Functions is 1.0.2, so one of its dependencies is the Newtonsoft.Json could only use 9.0.1 version.
And if you want to install the lastest stable 9.0.0.1 version of Microsoft.Azure.Storage.Common. It is hard to achieve.
Because no matter what the version of Microsoft.Azure.Storage.Common is, the Newtonsoft.Json must be >=10.0.2.
So, I suggest that you could update the version of Newtonsoft.Json to 10.0.2 and the Microsoft.NET.Sdk.Function will automatically update.
Then you could install the Microsoft.Azure.Storage.Common.
Upvotes: 1