When I try to install packages I get this error:
Could not connect to the feed specified at "https://nuget.org/api/v2/"'.
Please verify that the package source (located in the Package Manager Settings) is
valid and ensure your network connectivity.
If you are using Visual Studio 2017 then the source for nuget.org (the NuGet feed) is 'https://api.nuget.org/v3/index.json'.
Try changing your source path to that. You can do that by selecting Tools -> Options from the main menu and then NuGet Package Manager -> Package Sources.
There you will see a list of sources, where you can add your own with the green arrow on the top right.
I'd recommend that you read the documentation on NuGet usage here.
Related
I have a .net core intranet web app which uses certain nuget packages. I have two machines, my local computer with internet and a test machine with no connection to outside internet. The app works fine on my computer.
All the nuget packages are locally stored and referred by the web app.
When I try to build the app on test machine, I am getting the following error
C:\Program Files\dotnet\sdk\3.0.100\Nuget.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json
What process is actually looking for service index from outside url? Of course it cannot find because there is no internet. No proxies involved so nothing to put in nuget.config
All the packages are locally stored. What can I do to resolve this issue?
Thank you
You’ll need a local folder to keep all your local NuGet packages..
Then download the NuGet packages you wish to be able to use offline into this folder. Packages can be downloaded from nuget.org.
Once you are logged in, search for the packages you require and click the ‘Download’ link in the left hand menu of each.
Once you have successfully downloaded the .nupkg files you require into your local repository folder, head into Visual Studio and open the NuGet Settings dialog via Tools > NuGet Package Manager > Package Manager Settings. Click the Package Sources tab within the settings dialog, followed by the ‘plus’ icon in the top left to add a new package source.
Enter the Name and Source of your local repository. The name can be any string and will be the name displayed in the NuGet Package Manager within Visual Studio.
Now that you have added the local package source, you will be able
to use your offline local repository from within Visual Studio in
the usual way, either via the Console or via the Package Dialog, by
selecting it from the Package Source menu, without the need for an active internet connection.
Working with VS2015 I recently updated an add-on I use, ActiveReports, to a new version. Previously I had my application set for netframework 4.0, the new update for ActiveReports required at least netframework 4.5 so I changed the project to use that version.
I am getting the following error now when I build the project:
"Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: Microsoft.Bcl, Microsoft.Net.Http"
I have been looking at the various options suggested to address this none have worked. The last one I tried from Tools> NuGet Package Manager > Package Manager Console resulted in the following message:
PM> Update-Package
Attempting to gather dependency information for multiple packages with respect to project 'My Project', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for multiple packages.
Resolving actions install multiple packages
Resolution was successful but resulted in no action
There are no new updates available.
No package updates are available from the current package source for project 'My Project'
I can reproduce this by:
creating a new project as .NET 3.5, installing NuGet package Newtonsoft.Json" (just for example).
Changing my project to .NET 4.5
Then I receive an error:
Severity Code Description Project File Line Suppression State
Error Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: Newtonsoft.Json ConsoleApp7 0
To resolve:
Uninstall the existing NuGet packages (for that project), and reinstall them:
How:
Right-click your Solution:
Choose "Manage NuGet Packages for Solution..."
Navigate to the "Project" you changed to .NET 4.5
Choose "Uninstall", then try to reinstall them, using the same steps.
After re-installation of the package is complete, the build error is gone.
I am trying to setup a CI build using Visual Studio Online but I am getting the following error about the NuGet client:
The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.
Solution builds and deploys fine directly from my Visual Studio 2015 itself but I am unable to get it to build in VSO. Does anyone if NuGet 3.x is installed on hosted build controllers or if I can supply my own copy along with my solution?
It's hard to guess by the question what build tasks are used. If you use VSBuild/MSBuild, it is only possible to turn "Restore NuGet packages" on, but there's no influence on the NuGet version.
However, if you turn this checkbox off, and instead add another build task called NuGet Installer before the main build step, you'll be able to provide a custom path to NuGet.exe. In the case of hosted build agent, the most obvious option is to commit required version of NuGet.exe to the repo, and then reference it from the build step:
Sounds like a hack, but it might work in your case.
I want to include Plus.v1 namespace in my mvc application. I am unable to find any package on nuget to download the dll's.
www.nuget.org has been experiencing some problems, especially related to search. Please check back later and sorry for the inconveniences.
Run the following command in the Package Manager Console: Install-Package Google.Apis.Plus.v1
To access PMC (Package Manager Console) go to "Tools -> Nuget Package Manager -> Package Manager Console"
Thought I would try and get the most out of my visualstudio.com trial membership. I created a solution with a few projects, pushed it to the Microsoft git source control provider, configured a build definition and tried to build it on the project server. However it keeps failing telling me:
The type or namespace name 'Moq' could not be found (are you
missing a using directive or an assembly reference?)
I know this means that the build server can't find the Moq.dll library. I had installed it using NuGet, but configured my .gitignore to keep the packages folder out of source control. I also enabled NuGet package restore for the solution and pushed nuget.exe, nuget.targets, and nuget.config (all 3 of the files in the .nuget folder) along with all of the other project files.
Now I am sure I could get the build to work if I pushed the packages folder too, but I want to keep the nuget packages folder out of source control. So I am wondering, is this possible? The visualstudio.com docs say that the build servers have visual studio 2013 installed, and because of this I assume that nuget package restore would work to download the missing dll's so that they can be resolved by MSBuild. Is this right? Or to use automated CI builds at visualstudio.com, do you need to have your packages under source control?
According to the log file, nuget package restore downloaded the package. What gives?
Project "C:\a\src\MySln.sln" (1) is building
"C:\a\src\Tests\MySln.ProjA.UnitTests\MySln.ProjA.UnitTests.csproj"
(3) on node 1 (default targets). RestorePackages:
"C:\a\src.nuget\NuGet.exe" install
"C:\a\src\Tests\MySln.ProjA.UnitTests\packages.config" -source ""
-NonInteractive -RequireConsent -solutionDir "C:\a\src\ " Restoring NuGet packages... To prevent NuGet from downloading packages during
build, open the Visual Studio Options dialog, click on the Package
Manager node and uncheck 'Allow NuGet to download missing packages'.
All packages listed in packages.config are already installed.
PrepareForBuild: Creating directory "obj\Debug\".
ResolveAssemblyReferences: Primary reference "Moq". C:\Program Files
(x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1635,5):
warning MSB3245: Could not resolve this reference. Could not locate
the assembly "Moq". Check to make sure the assembly exists on disk. If
this reference is required by your code, you may get compilation
errors.
[C:\a\src\Tests\MySln.ProjA.UnitTests\MySln.ProjA.UnitTests.csproj]
This line is also in the build log file, below the above:
Considered "..\packages\Moq.4.1.1311.0615\lib\net40\Moq.dll", but it didn't exist.
I had this same error but it was occurring on our build server. I had added Moq via NuGet, checked in the project and everything was fine. I then moved the project into a new folder in TFS and the build server just couldn't seem to find Moq. It was building great locally. I ended up fixing the problem by making sure all of my changes were checked into source control and then deleting my local source code directory. I got latest and my test project realized it needed a new copy of Moq. I blame TFS/ source safe or what ever the Visual Studio integration module is for not adding it to source control at some point in time.
Figured this one out on my own. Turns out I had added the nuget packages before moving the test project into a Tests subfolder. The solution still built on my LM, probably because the dependencies were already copied to bin/Debug. After reinstalling the nuget packages, the solution built on vs.com.