当我保存脚本时,VS2019 会删除我的引用吗?

VS2019 is dropping my references when I save the script?

所以我在这里按照本教程尝试从 REST API:

获取数据

https://www.c-sharpcorner.com/article/how-to-consume-web-api-through-ssis-package/

而且我已经完成了所有步骤,必须弄清楚如何使用 nuget 来获取它丢失的过时包,并且 Async 中的 'response' 抛出了错误,但这没关系。无论如何,我收到了指南似乎含糊地涵盖的错误,但我不明白。

Error: 0x1 at Script Task: Could not load file or assembly 'System.Net.Http.Formatting

这是我保存脚本并尝试 运行 的时候。我注意到当我回到编辑器时,nuget 包不见了......?这是为什么?这是 "Microsoft.AspNet.WebApi.Client" 一个。我一直在重新安装它,但是当我保存脚本并退出编辑器时,VS 只是 "loses" 它。我再次打开脚本任务,并且必须像第一次那样重新安装它。

This is when I save the script and try to run it. I notice that when I go back into the editor, the nuget package is gone...? Why is that?

你应该将这些DLL注册到GAC中,这样VSTA工程就可以直接引用了。

解决方案

1)打开Powershell然后进入这些DLLS的路径:

 cd "Path of dll"

2) 像这样注册任何 msissing DLLs:

gacutil /i System.Net.Http.Formatting.dll
gacutil /i Newtonsoft.Json.dll

3)别忘了勾选Tools-->Options-->Nuget Package Manager-->这两个选项General

4)将这些添加到GAC后,可以再次打开ssis打包脚本任务查看引用是否恢复