简体   繁体   English

在没有Visual Studio的项目中添加NuGet包

[英]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的帖子中添加一个附加答案,您有两种选择。

  • Use Nuget.exe ( Related Blog post ) 使用Nuget.exe( 相关博客文章
  • NuGet Addin for MonoDevelop and Xamarin Studio (see GitHub ) 适用于MonoDevelop和Xamarin Studio的NuGet插件(请参阅GitHub
  • ASP.NET Pages using WebMatrix (see this video ) 使用WebMatrix的ASP.NET页(请参阅此视频

All of this info is from the Nuget FAQ . 所有这些信息都来自Nuget FAQ

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

相关问题 在不使用Visual Studio的情况下将nuget包添加到项目文件中 - Add nuget package into project file without Visual Studio 无法在Visual Studio 2015 Web API项目中添加nuget程序包 - Can not add a nuget package in visual studio 2015 web api project 在Visual Studio中构建项目时如何安装Nuget包 - How install Nuget package when building project in Visual Studio 是否有任何 NuGet API 可以从 Visual Studio 扩展项目创建包 - Is there any NuGet API to create a Package from a Visual Studio Extension project Visual Studio 2015 - NuGet包删除所有项目引用 - Visual Studio 2015 - NuGet package removes all project references 使用 nuget package 代替项目参考 Visual Studio - Use nuget package instead of project reference Visual studio Nuget 包未在 Visual Studio 中更新 - Nuget package not updating in Visual Studio Visual Studio 不会在项目和 NuGet 引用之间切换而不重新启动 - Visual Studio is not switching beween project and NuGet references without restarting 安装项目Visual Studio和Nuget - Setup project Visual Studio and Nuget 如何下载没有 nuget.exe 或 Visual Studio 扩展的 Nuget 包? - How to download a Nuget package without nuget.exe or Visual Studio extension?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM