0
votes

We are using azure function SDK in visual studio 2017 in .Net Frame work 4.6. We have added nuget packages

Microsoft.Azure.Devices.Shared 1.15.1 Newtonsoft.Json 12.0.1
AzureFunctions.Autofac 3.0.7 (for dependency injection )

when creating a instance of Twin we are getting a the following exception message

"message": "Could not load file or assembly 'Newtonsoft.Json,Version=10.0.0.0, > Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.",

We tried downgrading the package to

Newtonsoft.Json 10.0.1

Then we are getting the same error by replacing missing Newtonsoft.Json version 10.0.1 with Newtonsoft.Json version 12.0.1 .

this is the code we are following .

    Twin updatetwin = new Twin(); 
    updatetwin.ETag = "*"; 
    var body = await RequestBody(req); 
    var newtwin =JsonConvert.DeserializeObject<PropertyViewModel>(body);
1
do you have to use .NET Framework? If you could switch to NET Core and Functions v2, the whole issue about dependencies should go away. - silent
@silent we have a lot code written in .net frame work changing it will take a lot of time is there any other way to solve the dll missing issue ? - Vishnu Kv

1 Answers

0
votes

I am using

Newtonsoft.Json 9.0.1

with .net framework 4.6 and

Microsoft.NET.Sdk.Functions 1.0.13

You can check required dependencies in nuget package manager-

enter image description here