.Net Core和NuGet [英] .Net Core and NuGet

查看:117
本文介绍了.Net Core和NuGet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从该站点安装了.net核心。使用它会导致许多相关的软件包管理问题:

I installed .net core from this site. Playing with it led to a number of related package management questions:


  1. dotnet还原命令继续安装 .net核心NuGet软件包。这些软件包在哪里安装?

  2. hello world最小示例的 dotnet恢复大约需要一百个NuGet软件包,其中大概有99%与 hello world应用无关。当然,.net本机版本将删除不需要的所有内容-但我希望 restore 也会抢到很少的东西(三个或四个软件包,而不是一百个) 。为什么会出现这种情况?

  3. 我创建了第二个 hello world项目,然后再次运行 dotnet restore 。这次根本没有安装任何软件包。似乎所有第一次安装的软件包都已移到某个全局位置进行共享。我以为.Net Core不能那样工作。我认为.Net Core项目将所有依赖项保留在本地。我针对的唯一框架是 dnxcore50 。为什么会这样呢?

  4. 我想卸载所有这些全局软件包,然后重试(仅出于学习目的)。如何实现?请记住,正如问题1所述,我不知道所有这些文件的安装位置。

  5. 几乎所有通过还原命令被列为beta。奇。我以为.Net Core在RC1中,而不是beta中。对此感到困惑。为什么会这样?

  1. The dotnet restore command proceeded to "install" .net core NuGet packages. Where were those packages "installed"? A new folder was not created.
  2. The dotnet restore for the "hello world" minimal example required about a hundred NuGet packages, where 99% were presumably irrelevant to the "hello world" app. Granted, a .net native build will remove all that is not needed - but I expected that the restore also would have grabbed very little (three or four packages, not a hundred). Why this behavior?
  3. I created a second "hello world" project and again ran dotnet restore. This time no packages were installed at all. It seems all the packages installed the first time-around went into some global location to be shared. I thought .Net Core didn't work that way. I thought .Net Core projects kept all their dependencies locally. The only framework I targeted was dnxcore50. Why this behavior?
  4. I would like to "uninstall" all these global packages, and try again (just for learning purposes). How might that be accomplished? Remember, as stated in question #1, I don't know where all those files were installed.
  5. Almost all of the packages installed via the restore command were listed as beta. Odd. I thought .Net Core was in RC1, not beta. Confused by this. Why this behavior?

我也很好奇,哪些文档可能/会向我解释这些。我尝试对所有这些问题进行谷歌搜索,却一无所获(也许只是可怕的Google-fu?)。

I'm also curious of what documentation could/would have explained all this to me. I tried googling for each of these questions, and found nothing (perhaps just horrible google-fu?).

推荐答案

更新:


  1. nuget软件包安装在全局位置。默认情况下,它以前是..\Users\ [YourUserFolder] \.dnx\软件包,但似乎已更改为..\Users\ [YourUserFolder] \.nuget\packages

在NuGet 3+中,您可以使用NuGet CLI的以下命令来获取global-packages文件夹的位置

In NuGet 3+, you can use the NuGet CLI's following command to get the global-packages folder location

nuget locals global-packages -list

查看以下链接以获取有关NuGet的更多详细信息

Check out following links for more details about NuGet

https://docs.nuget.org/ndocs/消费包/配置-行为-行为

https://docs.nuget.org/ndocs/tools/nuget.exe-cli-reference#locals


  1. 默认的ASP.Net模板有很多软件包。由于您是第一次尝试,它尝试获取所有这100个软件包

  1. The default ASP.Net template has so many packages. Since you tried first time, it tried get all those 100s of packages

您已经在nuget全局位置中拥有了那些软件包,因此跳过了恢复。

You already had those packages in your nuget global locations, it skipped the restore.

删除包文件夹下的所有内容(位置在1中指示)

Delete all contents under packages folder (location indicated in 1)

某些beta版本包在那里。您可以转到project.json文件(位于Web根目录下)并使用依赖项部分。

Some of the beta packages are there. You can go to project.json file (available under the web root) and play with the dependencies section.

这篇关于.Net Core和NuGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆