I am getting the following exception while adding NuGet package to project. I am using the latest version of Visual Studio 2017 Pro.
try going to VS settings -> NuGet settings -> clear the NuGet cache, close Visual Studio, and delete all obj and bin folders in solutions .
Error while adding NuGet Package
AFAIK, It seems an issue which needs to be fixed from Xamarin team and someone already reported it:
https://bugzilla.xamarin.com/show_bug.cgi?id=61113
You can track this thread to get future updates for this issue.
Here are some of the workarounds already mentioned in that thread:
Update the packages with the option -IgnoreDependencies in the Package Manager Console (It works for me):
Update-Package -IgnoreDependencies
Update Visual Studio to latest version and running as Administrator
Some of the files in the packages folder were set to read-only. Try to cleare the read-only flag from all files in the packages folder.
Hope this helps.
I tried a lot of ways to solve this problem. But unfortunately cleaning the cache, project, rebuilding didn't help. The only thing I didn't try is to re-install Visual Studio or Windows.
I've got to launch project in Visual Studio for Mac and update/add all the necessary Nuget packages from there. On the Mac, the process was successful. I know this might not be an option if you don't have device, but it definitely works.
Related
The NuGet prompt, "Multiple packages failed to uninstall. Restart Visual Studio to finish the process," appears repeatedly in Visual Studio 2017 no matter how many times I restart the application.
I'm selecting Tools > NuGet Package Manager > Manage NuGet Packages For Solution. Then this dialog appears.
We have a solution in VS 2017 with multiple NuGet package references which will not resolve. A colleague added these references, but when I load the solution they show up with the yellow triangles in the "bin" directory in Solution Explorer.
The missing references are for .pdb and .xml files. These problems started occurring after Visual Studio 2017 was reinstalled on my PC.
Really, I don't want to remove the references. I want them to resolve. And I want to get out of this NuGet Restart loop. Perhaps my NuGet package manager settings need to be adjusted, or I need to use the NuGet Command Prompt to fix this. Just don't know the next steps. Thanks for your help.
How do I fix this NuGet Restart loop in Visual Studio 2017?
It seems this nuget package is locked by other process, like File Explorer.
To resolve this issue, close all the Visual Studio instance first, then try to delete the \packages folder in the solution folder and delete the \bin folder manually. If you project type is .net core/.net standard, you need to clear the packages cache:
# Clear all caches (use either command)
dotnet nuget locals all --clear
nuget locals all -clear
Do not forget to restart the PC after above operations.
Check the document Clearing local folders for some more details.
Besides, do not worry those references will be removed, when you build the project, nuget will restore those package, and if find any reference missing, just execute NuGet command line in the Package Manager Console:
Update-Package -reinstall
NuGet will reinstall those packages and add references to the project.
Check the similar thread for some more details.
Hope this helps.
I have the error from below and I'm quite out of ideas how to solve it. Tried the following until now:
Clean bin/obj/packages/packages cache
Remove manually from csproj and packages files the package and add it afterwards..still error
Update Visual Studio 2017
Reinstall Visual Studio 2017
Trace which processes are using a file with name that contains Newtonsoft
Copy the solution from another laptop where the builds works just fine
Yet, after all from above, I still get:
Error NuGet Package restore failed for project DriversApp.Android: Unable to find version '10.0.3' of package 'Newtonsoft.Json'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Newtonsoft.Json.10.0.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
https://api.nuget.org/v3/index.json: Error downloading 'Newtonsoft.Json.10.0.3' from 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.3/newtonsoft.json.10.0.3.nupkg'.
The process cannot access the file 'C:\Users\user\.nuget\packages\newtonsoft.json\10.0.3\lib\netstandard1.0\Newtonsoft.Json.dll' because it is being used by another process.
. Please see Error List window for detailed warnings and errors.
How to get this solved? I got really stuck on this one...
After a lot of investigation and ideas, I've solved this by uninstalling the antivirus solution as the rules added by me within my laptop were overrode by the company server policies.
As a conclusion, first check your antivirus solution, and if you are within a controlled environment, make sure your rules are not overrode by company server policies.
Thank you, #Leo Liu-MSFT for the assistance.
nuget dll is used by another process
You can try to use following troubleshooting to resolve this issue.
In Windows Explorer go to the folder where the NuGet packages are installed C:\Users\user\.nuget\packages, deleted the Newtonsoft.Json folders.
May it has something to do with the same package being referenced in multiple projects within the same solution, adding "-DisableParallelProcessing" to the nuget restore command, the final command would look like:
nuget restore "%WORKSPACE%\Solutions\App\App.sln" -DisableParallelProcessing
Excluding NuGet package files from the anti-malware products, or try to disable the antivirus. The anti-malware/antivirus products briefly locking these files during the NuGet restore operations.
Clear all referenced libraries before build the project by right click to Solution in solution explorer after click to "Clean Solution".
Most probably I was faced when there is some other error in the project (ie: project reference error etc.)
try 0: Remove all bin & obj from all project.
Try 1: Restart PC
Try 2: close vs & %temp% delete all
Try 3: Disable antivirus for the moment
Try 4: Change Debug to Release and revert back
Try 5: Clear All nuget caches
If above nothing works then shut down your pc, sit back for moments, relax and then check back.
Run this command with admin rights (net session /delete). It worked for me.
I just did a fresh install of visual studio community edition.
When I start a new project and choose 'Blank App (Universal Windows)' I get this error during project creation:
Package Installation Error
Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files (x86)\Microsoft SDKs\NETCoreSDK':
Microsoft.NetCore.UniversalWindowsPlatform.5.0.0: Package restore failed. Rolling back package changes for 'AppTest'
Any ideas what the cause of this error can be?
I installed all the Universal Windows App Development Tools:
- Tools (1.3.2) and Windows 10 SDK (10.0.10586)
- Emulators for Windows 10 Mobile (10.0.10586)
- Windows 10 SDK (10.0.10240).
What am i missing. How can I solve this issue?
Sometimes nuget fails to install the UniversalWindowsPlatform package. Search for "Microsoft.NETCore.UniversalWindowsPlatform" nuget package and install it.
This is not an answer, I have the exact same issue and I have found other people with the same issue on the web, no one has come up with a solution yet.
This is upon creation of 'any' UWP project type, blank, templated, VB, C#.
This dialog pops up:
I have already found and tried all of the steps mentioned by Jay Zuo. This is actually for a slightly different issue, the dialog is exactly the same apart from the bit, where we have ': Package restore failed.'
They are getting ': Solution is not opened or not saved'
None of the steps on that post help resolve this issue.
I have tried restoring VS, Reinstalling the Windows 10 SDK, resetting VS using the various options to reset user data, environment etc, made sure the path to the SDK files exists.
Nothing has worked and my VS2015 Community is utterly useless right now for working on UWP projects. This is a new Windows 10 / VS install (VS on insider fast PC has no issue at all but I need this one on production build).
I am posting as an answer as I do not have enough points to comment but starting a new thread seems daft as this is the exact same issue, I just want to add more detail to it.
I had the same probem after a clean install of OS/Updates/VS 2015 Update 3 + Xamarin update. I created a Universal 'Blank XAML App (Xamarin Forms Portable)' During creation I received same error.
In the Nuget Package Manager Console pick AppX.UWP, then run:
Install-Package Microsoft.NETCore.UniversalWindowsPlatform
Restart VS and create a new project, error does not come back.
So after much back and forth between myself and an MS rep on their forums I did actually manage to resolve this.
The forum link is here
I did actually need to reset my VS installation to try and get a clean install.
Then the actual error reared its head. In my case it was Nuget caching corrupt packages (these are not cleaned by a VS reinstall).
The link that helped me resolve it in the end can be found here on Stack Overflow
What helped me was to update the UniversalWindowsPlatform package in nuget to 5.1.0. Then all went smoothly the next time I created UWP project.
Upgrading the package Microsoft.NetCore.UniversalWindowsPlatform.5.2.2 worked for me...
After facing a similar problem with Microsoft.NetCore.UniversalWindowsPlatform.5.2.3. I found a solution which might help someone. I navigated to my ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Net.CoreUWP,version=1.0.4 and ran the netfx_NETCoreUWP.exe. It did resolve my problem
Just as a reference...
My NugetPackage "'Microsoft.NETCore.UniversalWindowsPlatform" disappeared from my project references. It showed up as installed in NuGet. I uninstalled and re-installed without success. I restarted Visual Studio and re-installed and the package reappeared :-) !
I am having serious problems getting Solutions to build in Visual Studios 2015. Before I would just click "Enable NuGet Package Restore" in Visual Studios 2013 and everything comes in just fine.
I see this exact same question how-to-enable-nugets-package-restore-in-vs-2015
the answer was:
delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.
pardon my French, but besides this being bullshit. The fact that you have to manually go into every single project in your solution and mess around , it also is not working for me. Maybe the guy that wrote this had 3 or 4 projects , I have 30+ that are referenced.
That was back in June , has anyone found a working or simpler way to achieve this functionality that was working perfectly prior to VS 2015?
This setting is on by default since NuGet 2.7. Use a small Powershell script to migrate from the old MSBuild to the automatic restore of 2.7 to fix your issues.
When a package is not installed you see this dialog at start of the build process where NuGet restores the missing package:
It's very possible that I'm missing something simple because I can't find others on the internet experiencing the same thing.
I'm a team that's new to the use of TFS and Visual Studio Online and we're encountering this problem:
(Using Visual Studio 2015 & 2013)
I used NuGet to add Microsoft.AspNet.WebApi.Cors to my newly created WebAPI project (ditto all other NuGet packages)
Did my work and checked in a building solution in to VSO
Co-worker did a Get Latest
His newly-retrieved project won't build and, when we expand the References, the assemblies are marked with a yellow warning icon, indicating that they're missing
We've tried (from the context of the failing project):
Update-Package
Update-Package -reinstall
Manually uninstalling and reinstalling the package in the NuGet UI
Manually adding the entire contents of the Packages directory in to TFS and doing a get latest on that directory as well
Wiping the solution out from his local file system and pulling it down clean
Copying the contents of my {Solution Directory}\Packages to a USB drive, walking it to my co-worker's computer, and copying it to his machine
Only item #6 worked but I'm CERTAIN that this cannot be the right answer.
I guarantee that this is worthy of a dope-slap but what might I be missing?
Thank you to jessehouwing for reminding me that this topic is still out here. He's exactly right on. We removed the Packages folder from source control and that resolved the problem completely.