简体   繁体   English

从配置文件安装Nuget软件包

[英]Installing Nuget packages from a config file

I'm used to gems, pip, and npm in the fact that I can provide some form of config file and the package management utility will install the items in that config for me. 我习惯了gems,pip和npm,因为我可以提供某种形式的配置文件,而程序包管理实用程序将为我安装该配置中的项目。

I'm trying to find this feature in nuget for .Net but coming up short. 我想在.net的nuget中找到此功能,但很快就会发现。 I saw a command line utility that will download the packages of the config; 我看到了一个命令行实用程序,它将下载配置包。 however, I'd still have to manually add the references at that point (and it wouldn't take advantage of any script tasks that the package does to add additional files and what not). 但是,此时我仍然必须手动添加引用(并且不会利用程序包添加任何其他文件所需要的脚本任务)。

So is there a way to use nuget that'll download packages from a custom package.config file, add the references to the project, and change/add any files that are associated with the packages? 那么有没有办法使用nuget来从自定义package.config文件中下载软件包,添加对项目的引用以及更改/添加与软件包相关联的任何文件?

Yes. 是。 By default Nuget puts the package files in a folder called ./packages. 默认情况下,Nuget将软件包文件放在名为./packages的文件夹中。 If you right-click your solution in Visual Studio and select "Enable Package Restore" it will add a config, exe, and targets file for your projects. 如果在Visual Studio中右键单击您的解决方案,然后选择“启用程序包还原”,它将为您的项目添加配置,exe和目标文件。

This will enable the project to download any files missing at compile time. 这将使项目能够下载编译时缺少的所有文件。

No there's no way to do what you want. 没有,没有办法做你想要的。 We never modify the project files outside of the IDE itself. 我们绝不会在IDE本身之外修改项目文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM