Add custom nuget feed from the Package Manager Console (PowerShell) - visual-studio-2010

Is there a way to add custom nuget feeds without going through the GUI? I know I can open the "Manage Nuget Packages" dialog, go to Settings, and add from there. I'm looking for a way to add a feed through PowerShell.

You could modify nuget visual studio extensions configuration file (located by default at C:\Users\%UserName%\AppData\Roaming\NuGet) with PowerShell

Related

Nuget activate "Include Prerelease" via config file

Visual Studio 2017 offers the option to include prereleases of NuGet package via the GUI, like shown below:
Does anybody knows if it is possible to do this via NuGet.config or via csproj file?
Thx
Does anybody knows if it is possible to do this via NuGet.config or via csproj file?
I am afraid you could not activate the option Include Prerelease via NuGet.config or via csproj file.
Because this is a unique feature of Visual Studio instance, we could not use the configuration file of NuGet package management or the project file to change the Visual Studio configuration.
Besides, this is a long-term saved setting, if you check this checkbox, it will not unchecked until you change it next time.
What is more, NuGet team also provide us options -IncludePrerelease and -prerelease, so that we could use the pre-release package without NuGet package management UI.
Check more info from Installing and updating pre-release packages.
Hope this helps.
You mean to have this option set per default when opening the packagemanager ? not possible unfortunately

VS2013 - nuget.org gallery not showing

Trying to get the nugget.org gallery to show in VS2013 with no success.
Have installed the latest Nuget Package Manager extension is installed and ensure that the package source is pointing to nuget.org
I just can't seem to get the nuget.org gallery to appear. On either machines with VS2013 Update 4 installed.
Any idea or help to get this working.
The window in your screenshot is the Visual Studio Extension Manager. To access the Nuget repository you first need to create or open a project and then right-click the references item in the project (in the solution explorer). from the context menu you should find the option to "manage nuget packages for project". That will open the NuGet Repository screen.

Can Visual Studio 2012 save custom NuGet package sources in the solution?

I am looking at setting up a custom NuGet repository for my organization and I would like the ability to have the package sources saved against the solution so that other developers don't need to manually set up their own package sources, is this possible?
So my problem was that in order for the .Nuget folder to be created automatic restore needs to be enabled by Right clicking on the solution in VS and choosing "Enable Nuget Package Restore" rather than relying on the visual studio option.
Yes you can, if you make use of the MSBuild based package restore functionality. Detailed steps can be found in this blog post: http://xavierdecoster.com/nuget-package-restore-using-solution-specific

Visual Studio add custom command to run in Package Manager Console?

I am trying to create a button which will automatically run few powershell commands which are imported in nuget package (tools in nuget package)
I found out how to add custom button in this question: How can I add a custom command to Visual Studio?. But I cannot find out how to run from this command in package manager console.
So is there a way to add custom command button to visual studio, which will start and run command in package manager console?
Using a custom command described by link, you can run only external tools. In your case, you can run NuGet command line utility. First, you need to download nuget.exe. Then you have to add a custom command, arguments for it and initial directory in External Tools dialog. You can use solution variables (e.g., $(ProjectFileName), $(SolutionDir)) for arguments and initial directory fields. You can use bat file to run few commands.
Unfortunately, the NuGet command line utility has fewer features than package manager console. I don't know, is it enough of these features to solve your issue?
To use all features of NuGet and to integrate into Visual Studio, you can implement your VSPackage. From VSPackage you can add at any place of Visual Studio the custom command (as a button or menu item). When the command launch (user clicked your button), you can call any method of NuGet API inside Visual Studio. This way requires time to develop and not so simple.

Nuget - Don't see allow nuget to download missing packages during build

I get a message saying the following:
Error 1 Package restore is disabled by default. To give consent, open
the Visual Studio Options dialog, click on Package Manager node and
check 'Allow NuGet to download missing packages during build.' You can
also give consent by setting the environment variable
'EnableNuGetPackageRestore' to 'true'.
When I go to Tools -> Options, I do not see Package Manager and underneath I see Package Sources and Recent Packages. I do not see anywhere where I can set Allow Nuget to download missing packages during build though.
The option to give consent in the UI has been added with NuGet Package Manager 1.8. It's the 3rd item under Tools-> Options-> Package Manager-> General : "Package Restore : Allow NuGet to download missing packages during build".
Please make sure NuGet is up-to-date in Tools->Extension Manager.
Alternatively you can give consent by setting the EnableNuGetPackageRestore Environment variable to true.
I found I needed an extra couple of steps to get it to download the packages
Check Allow NuGet to download missing packages during build
Check Always show solution in Projects and Solutions
Right click on solution and Enable NuGet Package Restore
Open Manage NuGet Packages and click Restore
I did not seem to have the "Package Manager" node under Tools->Options [this was in Visual Studio 2013 :-)]. To get that node in there, I browsed to Tools -> Extensions and Updates and searched for nuget. Installing "NuGet for Visual Studio 2013" got me the node and the option to allow package restore!
I am using Visual Studio 2010 and NuGet 2.0.
Someone had checked in a solution that used NuGet for various packages. When I checked out the solution and built it, I got the same errors. What's more, when I viewed the NuGet Package Manager from the Tools -> Options window, the Package Restore already had the appropriate check boxes checked.
I tried clicking the Clear Package Cache button. After doing that, everything built correctly.

Resources