如何在命令行上将 NuGet 包安装到 Visual Studio 项目 [英] How to install a NuGet package on the command line to a Visual Studio project

查看:54
本文介绍了如何在命令行上将 NuGet 包安装到 Visual Studio 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了 nuget.exe 并尝试安装.我想定位一个 Visual Studio 项目,以便它在 Visual Studio 之外的命令行上添加一个引用.它只是下载末尾带有版本号的包.MyOutputDirectory 是输出目录,其中包含 Visual Studio 解决方案.

I downloaded nuget.exe and I have tried the install. I would like to target a Visual Studio project so it adds a reference on the command line outside of Visual Studio. It is simply downloading the package with a version number on the end. MyOutputDirectory is the output directory which has a Visual studio solution there.

nuget install nhibernate -o MyOutputDirectory

推荐答案

NuGet 命令行实际上不安装任何包.安装命令实际上是在执行恢复操作.

The NuGet Command Line does not actually install any packages. The install command is actually doing a restore operation.

这意味着 nuget.exe 安装只会下载包并将其解压缩到输出位置.它不会修改项目文件(因此不添加引用、不注入内容文件、不应用转换、不导入 MSBuild 文件),并且它也运行任何PowerShell 脚本.

This means that nuget.exe install will only download and extract the package into the output location. It will not modify the project file (so no references are added, no content files injected, no transformations applied, no MSBuild files imported), and it will also not run any PowerShell scripts.

我确实相信 NuGet 团队正在跟踪与您类似的请求,但请随时在此处记录问题:http://nuget.codeplex.com.

I do believe that a similar request to yours is being tracked by the NuGet team, but feel free to log an issue there: http://nuget.codeplex.com.

回答您的问题:NuGet 命令行目前不支持您的方案 (nuget.exe v2.8).

To answer your question: the NuGet Command Line does not support your scenario at this moment (nuget.exe v2.8).

这篇关于如何在命令行上将 NuGet 包安装到 Visual Studio 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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