Nuget activate "Include Prerelease" via config file - visual-studio

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

Related

Slow cheetah Add Transform does not appear

I want to use Slow Cheetah for transform .config file. Currently I am using Visual Studio 2017 and for this I have installed Slow Cheetah 2.5.48 from nuget but 'Add Transform' does not appear when I right-click on config file.
The issue is, only adding nugget would not suffice. You need to install slowcheetah from visual studio marketplace. Following are the steps:
Install SlowCheetah from Tools > Extensions and Updates
Restart VS, allowing for the VSIX installer to run
Create new C# App (.NET Framework). (In my case, it started to work on existing app also.)
GitHub Reference
As a work-around you could do this by hand.
Make a copy in the _Solution Explorer* of your Web.config and rename it to Web.Debug.config or whatever you like.
Unload the project and then Edit the project.
Find the ItemGroup element that contains your newly created config file and add the <DependentUpon>Web.config</DependentUpon> element there, like so:
After that, it will look like this in the Solution Explorer:
Now you can edit your newly added config file with the required transformations.
I had the same issue. I installed the NuGet package 2.5.48 and then was able to download and install the vsix file from here and it worked:
https://github.com/sayedihashimi/slow-cheetah/releases
Download it here
https://marketplace.visualstudio.com/items?itemName=WillBuikMSFT.SlowCheetah-XMLTransforms or search for "SlowCheetah" in Visualstudio marketplace,
install it
restart you VS and see.
Good luck
Correct as #Himanshu Singla and many others here are saying, in addition to installing nuget package, you still need to download the Extension from Tools->Extensions and Updates-> Search "Slow Cheetah", install and restart VS.
I had to do the following before it worked:
Install the package from their site instead of from NuGet
List item
Restart VS
Then the Add Transform option started showing up in the drop-down menu.

TFS solution is downloaded along with the Nuget Packages but the references are missing?

I'm training 5 people on using Visual Studio. They've mapped their drives and have "downloaded" the solution from TFS which contains 10 projects. All located at the same depth in TFS folder structure. When the new folks download the solution there's one project that doesn't get the NUGET references even though the Package folder (created by NUGET) is at the same depth of the other 10 projects when viewed in TFS.
We know how to add these manually but is there a way to automatically have VS do it? Why would only one project lose it's reference with the Package Folder right there?
It seems you are still using MSBuild-Integrated package restore approach. If NuGet recognizes that the MSBuild-Integrated package restore approach is enabled for the solution, Automatic Package Restore is skipped.
You need to migrating MSBuild-Integrated solutions to use Automatic Package Restore, then the packages will be restored automatically.
In addition, you need to update you NuGet manager to the latest version in VS Tools--Extensions and Updates. And make sure Visual Studio is configured to 'Allow NuGet to download missing packages' and 'Automatically check for missing packages during build in Visual Studio' in VS Tools--Options--NuGet Package Mnager--General.
To Fix:
Unload all projects first, then right click and select edit project.
Find this line:
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
Comment it out.
Reload all the projects and compile.
This applies to Nuget api version 2.
Note you may configure all projects for Nuget at the solution level.
The package manager for the solution presents a set of check boxes for every project along with the buttons (Install or Uninstall).

Howto disable nuget machine-wide cache?

As you know NuGet uses %LOCALAPPDATA%\NuGet\Cache location for caching. It first checks if requested packages is here then download if needed.
How can I properly disable this cache mechanism from Nuget and "Visual Studio 2013", and make sure they always download from sources?
Can I build Nuget Package Manager Extension from source, then install it to Visual Studio? Or Are there any registry configuration that disable it?
Thanks
You cannot disable NuGet from using a cache. The only thing you can do without changing the source code is to change the location of the cache directory using a NuGetCachePath environment variable.
So you are left with clearing the local cache manually or automatically before installing a NuGet package or modifying the source code for NuGet's Visual Studio extension.
The source code for NuGet 2.8.5 and older is available on CodePlex.
The source code for NuGet 3.0 is available on GitHub
There are some instructions available on how to setup the NuGet development environment to be able to build and run NuGet within Visual Studio.
Currently it's possible to do so in case you'd running Install NuGet packages task through CLI which is common practice.
You can order NuGet to not use it's cache at all by using -NoCache input parameter. Then it will behave as you described. See CLI reference of NuGet.exe

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

Add custom nuget feed from the Package Manager Console (PowerShell)

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

Resources