Problem with ValueTuple in Azure Function (v1)

91 views Asked by At

I am currently experiencing a problem in one of my Azure Functions. I want to use a library that makes use of ValueTuple. The lib is built against .net Core 2.0. This leads to the following error message in my function:

Reference to type 'ValueTuple<,>' claims it is defined in 'System.Runtime', but it could not be found

I already tried to add the corresponding Nuget Package to my function:

{
  "frameworks": {
    "net46":{
  "dependencies": {
    "DocX": "1.2.1",
    "MediaTypeMap": "2.1.0",
"System.ValueTuple": "4.5.0"
  }
} 
  }
}

and referencing the assembly with:

#r "System.ValueTuple"

Any ideas how I could solve this?

Thanks a lot!

1

There are 1 answers

0
Peter Bons On

This is not going to work, according to the docs the V1 version cannot use .Net Core 2 libraries. Only v2 can.

So, try modifying the library to target .Net standard or migrate to Azure Functions V2:

Migrating from 1.x to 2.x
You may choose to migrate an existing app written to use the version 1.x runtime to instead use version 2.x. Most of the changes you need to make are related to changes in the language runtime, such as C# API changes between .NET Framework 4.7 and .NET Core 2. You'll also need to make sure your code and libraries are compatible with the language runtime you choose. Finally, be sure to note any changes in trigger, bindings, and features highlighted below. For the best migration results, you should create a new function app for version 2.x and port your existing version 1.x function code to the new app.