[英]Adding a NuGet package to a project without Visual Studio
I'm trying to automate adding NuGet packages to project on a remote server that doesn't have Visual Studio (nor any build servers) installed. 我正在尝试自动将NuGet软件包添加到未安装Visual Studio(也没有任何构建服务器)的远程服务器上的项目中。 I do know how to use NuGet.exe from my C# code, but this executable only downloads packages and doesn't do any other required work (adding references, executing ps scripts etc).
我确实知道如何从我的C#代码中使用NuGet.exe,但是此可执行文件仅下载程序包,并且不执行任何其他必需的工作(添加引用,执行ps脚本等)。 What do I do in order to fully install a package?
为了完全安装软件包,我该怎么做?
Note: I don't need to update a package for my own app, I need to add a package to an arbitrary .csproj file on the server. 注意:我不需要为自己的应用程序更新软件包,而是需要将软件包添加到服务器上的任意.csproj文件中。 I'm building a Web-based .Net IDE, and need my users to be able to add packages to their projects.
我正在构建一个基于Web的.Net IDE,并且需要我的用户能够将包添加到他们的项目中。
I see two possibilities: one is using some kind of functionality not present in NuGet.exe, but ratherin some other library (maybe a VS addin), but I don't know where to look for it. 我看到两种可能性:一种是使用NuGet.exe中没有的功能,而是使用某些其他库(可能是VS加载项)中的功能,但我不知道在哪里寻找它。 The other is to simulate some kind of NuGet Powershell console and send commands to it, but again, I don't know how to do that.
另一个是模拟某种NuGet Powershell控制台并向其发送命令,但是同样,我也不知道该怎么做。
You might want to consider SharpDevelop . 您可能要考虑SharpDevelop 。
Installing NuGet Packages outside of Visual Studio an article about the functionality you are trying to achieve (written by Matt Ward, one of the project contributors) says: 在Visual Studio外部安装NuGet软件包的文章,介绍了您要实现的功能(由项目贡献者之一Matt Ward撰写)说:
Since NuGet uses PowerShell the simplest approach was to extend the existing PowerShell cmdlets included with SharpDevelop.
由于NuGet使用PowerShell,所以最简单的方法是扩展SharpDevelop附带的现有PowerShell cmdlet。 Now you can write a few lines of PowerShell script to install a NuGet package into a project that has never had a NuGet package before, have the project itself updated and any package PowerShell scripts run.
现在,您可以编写几行PowerShell脚本,以将NuGet程序包安装到以前从未包含NuGet程序包的项目中,更新项目本身,并运行所有程序包PowerShell脚本。 All this from the command line without Visual Studio open.
所有这些都是在不打开Visual Studio的情况下从命令行完成的。
Just to add an additional answer in-line with Alex's post about SharpDevelop, you have a couple different options. 只是要在Alex关于SharpDevelop的帖子中添加一个附加答案,您有两种选择。
All of this info is from the Nuget FAQ . 所有这些信息都来自Nuget FAQ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.