Search code examples
c#azureazure-functionsneo4j-dotnet-driver

Azure Functions: Adding Neo4j Driver dependency to C# HTTP Trigger throws Error


Im creating a Azure function which should connect to a neo4j database after receiving a https request. I used the Visual Studio 2015 function preview to set up my project and to create a C# HTTP trigger function.

I then added a Neo4j dependency to my project.json

 "dependencies": {
        "Neo4j.Driver": "1.2.0"
  }

After a NuGet rebuild i get multiple error like the following:

run.csx(8,19): error CS1929: 'HttpRequestMessage' does not contain a definition for 'GetQueryNameValuePairs' and the best extension method overload 'HttpRequest  MessageExtensions.GetQueryNameValuePairs(HttpRequestMessage)' requires a receiver of type 'HttpRequestMessage'

I didn't change anything else of the default function code and after adding the dependent the Framework Versions are still the same.

Do i have to add some default dependencies so that i can still use the HTTP trigger?

Edit: i uploaded the Content of the project.lock.json files maybe this helps

Without dependency https://api.myjson.com/bins/1f5hrv

With dependency (3000 lines) https://api.myjson.com/bins/14fovv


Solution

  • The reference to Neo4j.Driver causes a reference to System.Net.Http to be added, using a version that leads to a type mismatch between what is referenced and the extension methods from the assemblies provided by the runtime.

    Please add your own references to System.Net.Http, see this stackoverflow question: Azure Functions - System.Net.Http