Visual Studio是微软发布的编程工具,并包含了包管理器。
微软的包管理对应的中央仓库站点是nuget.org,受众所周知的原因,很多时候,无法解析api.nuget.org。
可以用如下办法来解决此问题。
1、打开命令提示符,运行 nslookup api.nuget.org,记下“Address”对应的IP地址

2、以管理员身份运行记事本,打开如下文件


在hosts文件中增加行,输入之前通过nslookup获得IP地址,再添加空格,然后填写api.nuget.org,保存。
这样就可以搞定nuget经常打不开的问题。