newtonsoft json package requires reinstall every time i open code

房东的猫 提交于 2019-12-12 19:07:03

问题


I'm writing C# code in a script task in SSIS. I need to use the Newtonsoft JSON package in the code so i have installed it from NuGet. When it is first installed it works fine, but when I close my code and re-open it to make a change, I have to re-install the package using update-package -Reinstall as per the Some NuGet packages are missing from the solution in Visual Studio Application post.

Why do I have to do this every time? Am I doing something wrong?

Thanks for your help.


回答1:


I found that adding the assembly to the GAC manually fixed the issue for me. To do this:

  1. Open the "Developer Command Prompt for VS (SSDT)" in admin mode.
  2. Run this command: gacutil -i "assembly name"

For the assembly name, I just needed to browse my local drive for a copy of the DLL i was adding and then use the full file path (C:...Newtonsoft.json.dll) in the "assembly name".

https://docs.microsoft.com/en-us/dotnet/framework/app-domains/how-to-install-an-assembly-into-the-gac

https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs




回答2:


Try installing Json.Net from solution explorer:

  • json.net How to Install Json.Net in Visual Studio Projects

Workaround

Instead of using Json.Net you can benefit from System.Web.Extension assembly which is a part of the .Net Framework, you can refer to the following link for a step by step guide on how to parse JSON using this assembly:

  • Importing JSON Files Using SQL Server Integration Services


来源:https://stackoverflow.com/questions/55577736/newtonsoft-json-package-requires-reinstall-every-time-i-open-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!