.net 如何将 NuGet 与 Visual C# Express 结合使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4566908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use NuGet with Visual C# Express?
提问by Joe White
How can I use NuGet to add a library package reference, when I have Visual C# 2010 Express?
当我有 Visual C# 2010 Express 时,如何使用 NuGet 添加库包引用?
NuGet doesn't come up when I search for it in Tools > Extension Manager.
当我在工具 > 扩展管理器中搜索它时,NuGet 没有出现。
I downloaded "NuGet Package Manager" (the .vsix) from the downloads page, but when it prompts me for which versions of Visual studio to integrate into, it only lists Visual Web Developer Express 2010. Visual C# Express isn't shown. So I guess it would work with Silverlight in VWD, but I want to use it with WPF.
我从下载页面下载了“NuGet Package Manager”(.vsix),但是当它提示我选择要集成到哪个版本的 Visual Studio 时,它只列出了 Visual Web Developer Express 2010。没有显示 Visual C# Express。所以我想它可以在 VWD 中与 Silverlight 一起使用,但我想将它与 WPF 一起使用。
One of the documentation pages linked me to the 1.0 CTP download page, which included a command-line version of NuGet (no longer present in the latest version). But the command-line version seems to be crippled -- the only operation it seems to support is building a package for distribution; it doesn't seem to support the commands for adding a reference to a library package.
其中一个文档页面将我链接到1.0 CTP 下载页面,其中包括 NuGet 的命令行版本(最新版本中不再提供)。但是命令行版本似乎被削弱了——它似乎支持的唯一操作是构建一个用于分发的包;它似乎不支持添加对库包的引用的命令。
Is there any way at all to use NuGet with Visual C# Express?
有没有办法将 NuGet 与 Visual C# Express 一起使用?
采纳答案by David Ebbo
Update (9/12/2012): Good news: Visual Studio Express 2012 for Windows Desktop is now available (here), and it supports NuGet out of the box. Generally speaking, every edition of VS2012 now supports NuGet, so this limitation should be a thing of the past!
更新 (9/12/2012):好消息:适用于 Windows 桌面的 Visual Studio Express 2012 现已推出(此处),它支持开箱即用的 NuGet。一般来说,现在每个版本的 VS2012 都支持 NuGet,所以这个限制应该是过去的事情了!
Original answer:
原答案:
Microsoft signs NuGet in a way that allows it to work with VWD Express. Ideally, it would also be signed in a way that it works with C# Express (it may have to be a separate build). Unfortunately, we were not able to do this for the initial release (it's more of a challenge than you might think).
Microsoft 以允许它与 VWD Express 一起使用的方式签署 NuGet。理想情况下,它还将以与 C# Express 一起使用的方式进行签名(它可能必须是一个单独的构建)。不幸的是,我们无法在初始版本中做到这一点(这比您想象的更具挑战性)。
Going forward, we will try to enable this scenario. Feel free to file a bug on the NuGet site just to let others who are affected a chance to vote it up!
展望未来,我们将尝试启用此方案。随意在 NuGet 站点上提交错误,让其他受影响的人有机会投票!
回答by David
If you have VWD Express installed you can work around this as follows:
如果您安装了 VWD Express,您可以按如下方式解决此问题:
Save and close your project in c# Express
Open the project in VWD Express and use Nuget from there to add your packages
Save your project and go back to c# Express
在 c# Express 中保存并关闭您的项目
在 VWD Express 中打开项目并从那里使用 Nuget 添加你的包
保存您的项目并返回到 c# Express
回答by ejectamenta
To install a package in visual studio c# express 2010 use the command line tool nuget.exe. Download nuget.exe from the nuget websiteadd the path to the executable to the windows path environment variable, cd to a place you want you library to be then run it with the library name as an argument.
要在 Visual Studio c# express 2010 中安装包,请使用命令行工具 nuget.exe。从nuget 网站下载 nuget.exe将可执行文件的路径添加到 windows path 环境变量,cd 到您希望库所在的位置,然后使用库名称作为参数运行它。
C:\Code\myprojectdir\myproject>nuget install CommandLineParser
Installing 'CommandLineParser 1.9.71'.
Successfully installed 'CommandLineParser 1.9.71'.
Then just add a reference to the appropriate version of the dll (ie 4.0), in visual studio c# 2010 using project->add reference->browse. Then build the project.
然后只需在 Visual Studio c# 2010 中使用 project->add reference->browse 添加对相应版本的 dll(即 4.0)的引用。然后构建项目。
回答by SkyCodes00
Visit this video: https://youtu.be/8DcANVHLE0oThe way is: Download .exe file from nuget.org, and make a folder in %appdata% "NuGet", paste the exe file in the folder, after that open cmd, type cd (the folder adress), and type nuget install (package), the go in the package folder, lib, copy the dll file, and put it as Reference in visual basic
访问这个视频: https://youtu.be/8DcANVHLE0o 方法是:从nuget.org下载.exe文件,在%appdata%“NuGet”中创建一个文件夹,将exe文件粘贴到文件夹中,然后打开cmd ,输入cd(文件夹地址),输入nuget install(package),进入package文件夹,lib,复制dll文件,在visual basic中作为Reference

