For the life of me I can't find an option to install all nuget packages to a central folder.
The only option seems to be Install and that always installs into the project folder.
With multiple projects using the same packages this is very inefficient.
I'd like to install all packages to the same central folder.
Can this be done?
Answer is here: Is it possible to change the location of packages for NuGet?
I successfully tried it with VS2012 and the latest nuget manager.
Related
I am facing a problem with my project.
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?
This has happened before and I solved it by reinstalling the Nuget Package Manager using a command. Unfortunately, I am not finding that command again. I tried to find the solution online but everything I am getting is installing/reinstalling NuGet packages and not package manager.
Found this article: https://forums.asp.net/t/1776324.aspx?How+to+install+upgrade+VS+NuGet+Package+Manager+ but It's not applicable here.
NuGet Package Manager is preinstalled in VS2019 and no separate package to download and install. Also, there's not Extension Manage in VS2019 like older versions.
Please Let me know the command to reinstall NuGet Package Manager in Visual Studio 2019.
Such nuget restore issues can normally fix by deleting the obj folder where the nuget files like project.assets.json, projectname.csproj.nuget.g.targets, projectname.csproj.nuget.g.props, projectname.csproj.nuget.dgspec.json and projectnamecsproj.nuget.cache are stored.
If this still doesn't fix it, delete the hidden .vs folder inside the solution, where Visual Studio stores the user settings for the project.
In my solution I have a PCL project and two other projects, each for different platforms.
Sometimes a NuGet package used in PCL require installing it to the platform project as well, otherwise things will crash at runtime.
When I install the NuGet package, how do if it's also required to install it to the platform projects?
For example, it's not clear to me if Microsoft.Net.Http requires also installation in Xamarin Android project or not. This is just an example.
Or, I don't know if SQLite.Net-PCL requires it to be installed on platform projects as well.
Things you can do:
Read the documentation provided by the NuGet package author. Either from a project web site or in the description for the NuGet package.
Use your favourite search engine for examples of how to use that NuGet package.
If there are multiple NuGet packages that are named after the platform then that gives you an idea that the PCL NuGet package might not work in the platform specific project.
Have a look inside the NuGet package using something like the NuGet Package Explorer available on Windows. If the NuGet package has lib directories that are platform specific as well as a PCL directory then it will need to be installed in the platform specific project.
Run your application and see if it works.
Taking Microsoft.Net.Http as an example. The documentation does not really say explicitly. If you search the internet you can find a blog post or two that mentions that you have to install it into your platform specific project.
If you take a look inside the Microsoft.Net.Http NuGet package you can see it has several lib directories:
There are platform specific directories, such as MonoAndroid and Xamarin.iOS10 as well as PCL directories, such as portable-net45+win8. This suggests you should install it into all your projects.
I'm running the following command on a build server:
Nuget.exe install MyPkgName -Source C:\temp\somefolder -OutputDirectory C:\temp\someotherfolder
I'm running it as part of unpacking build artifacts (nuget packages) in TeamCity as part of a packaging process on a build server. So the same packages have been unpacked before on this server, but the workspace is cleaned everytime, yet it fails with:
All packages listed in C:\temp\packages.config are already installed.
There is no packages.config in that location, and I can't understand where nuget is storing the information that the package is installed.
Was a regex issue in the powershell script where it didnt get the package name correctly, my bad.
I know name of nuget package in official nuget gallery. How can I check on which platforms it's avaibale, e.g full .net, silverlight, windows store apps, universal platform, etc..?
On Windows I normally use the NuGet Package Explorer which will download the NuGet package and show you its contents. The frameworks it supports are shown in the lib directory inside the NuGet package.
You can also just download the NuGet package from NuGet and unzip it.
I just inherited a large enterprise system that appears to use NuGet.
I have just read the basics on what NuGet is so pardon the simpleness of my questions.
Is there a way to tell NuGet to update and install all the packages needed to run the system? I am right now running and seeing what fails then guessing what NuGet packages are missing.
(No, there was no documentation in the enterprise system or many code comments, ugh)
From the package manager console try Update-Package –Project ProjectName
Visual Studio -> Tools -> Library Package Manager -> Package Manager Console
http://nuget.codeplex.com/wikipage?title=Updating%20All%20Packages
If the solution is configured to enable Nuget Package Restore you could also just delete the packages folder and rebuild all which would get everything that you needed. If you need to worry about javascript, configuration, etc... I would try the Update-Package route