System.Security.Permissions missing when invoking JsonConvert.DeserializeObject in .NET Core 2.0

前端 未结 5 1865
小鲜肉
小鲜肉 2020-12-15 08:16

I am currently looking at using .NET Core 2.0 so that I can run my app on multiple platforms.

One thing I need to do is take an incoming string and deseralise it in

相关标签:
5条回答
  • 2020-12-15 08:43

    In my case, I've simply updated to Newtonsoft.Json latest available version and the issue is gone. I had the issue while migrating a lib from .net framework to .net standard and it was quite outdated.

    0 讨论(0)
  • 2020-12-15 08:44

    For me i could not connect to mysql database and i was getting this error "Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ffffd51".

    I resolved it by using nuget package manager to install Mysql.Data and also installed System.Security.Permissions. This solved my problem.

    0 讨论(0)
  • 2020-12-15 08:50

    This was due to a lack of understanding of how .NET Core works. I opened up the csproj and added a reference to the required file 'System.Security.Permissions' and reloaded the project. At this point, nuget resolved it. Json.NET now works as expected.

    0 讨论(0)
  • 2020-12-15 08:53

    To see where its update place,

    0 讨论(0)
  • 2020-12-15 08:58

    First look at the Packages section of your solution, most probably you will see warnings there:

    You should know that NuGet will not necessarily install the latest version for the library.
    Especially with the Newtonsoft.Json version 8.0.3 there is an issue with System.Security.Permissions reference, however, such an issue already doesn't exist with the 12.0.3 version.

    In this case (and most probably for a lot of other cases), the solution is to right-click on the Packages and choose "Manage Nuget Packages...".

    Then click on the "Update" button:

    Rebuild the solution(also you can try to close and open a solution too) and that's it ))

    0 讨论(0)
提交回复
热议问题