NuGet asks to restore unneeded package, unable to find package reference - visual-studio-2012

In Visual Studio 2012 with the NuGet Package Manager, NuGet prompts to restore version 9.0.1 of the package Json.NET. When I click the Restore button, the restore fails. This occurs even after removing Json.NET from every project in my solution.
The below screenshot shows that Json.NET is no longer installed locally, and that the requested package restore fails.
I would like to figure out why NuGet still thinks it needs this package, even though it's no longer referenced in any projects. I have even searched the contents of the .csproj files for the projects for references to the Newtonsoft.Json assembly, but there are none.
Update and answer:
Jeff Block's post below was the answer. There is a packages.config file for the solution. I thought I had deleted it through Visual Studio, but it had only been removed from the Solution Explorer. Deleting the file on the file system stopped NuGet from looking for that package.

Is the package being included from $(SolutionDir).nuget\packages.config or a 'solution level' configuration file?
Sorry for answering with a question, I apparently cannot make a comment on your question until I have earned reputation.

Related

How to undo nuget package installation in TFS without undoing project added files?

I have installed a nuget package to my project that is in TFS but now i want to undo this operation but undoing the operation will undo the edition in the project file but if i do this then other files that i have been added in the project will not be added.
How can i undo this without loosing the other files association to the project?
Open the project file in a text editor, remove the references you do not require.
Edit the packages file and remove the line for the package you want to remove
This is for those who come across this answer and try it (like I did). It doesn't work (anymore, maybe it did on a VS 2013 or older?). If you do this in e.g. VS2019 a XAML design window will show Some Assembly References are missing instead. No further useful info of course, VS never does give that.
In VS2019, just right click on the project in the Solution Explorer and select Manage NuGet Packages. Check the package you want to delete (project + package name) and click the delete button. This works without these errors.

VS2012/2013 fails to display solution explorer

I have this problem with both VS2012 and 2013. When I load an existing or create a new solution I get a ProviderPackage error - An exception was thrown during package instantiation and was caught in the package manager. After I close the error dialog, the solution explorer window is empty, although there are solution files open in the editor.
The ActivityLog.xml file shows different modules loading when the error occurs, depending on the project type. Is there a way that I can determine the common thread between 2012 and 2013 that is causing this error.
There is probably a corrupted dll which I have to replace. I am dead in the water until I figure this out.
Help.
Clearing the Visual Studio Component Model Cache worked for me (details: Error message "No exports were found that match the constraint contract name")
None of the previous suggestions worked for me, but this one did:
http://www.hjerpbakk.com/blog/2014/7/25/no-content-in-solution-explorer-using-visual-studio-2013
This issue is because of a MEF cache corruption. Installing [or uninstalling any extension] will invalidate the cache causing VS to rebuild it.
I ran into the empty solution explorer with Visual Studio 2013, and fixed it with a repair install.
Solution: This worked for me.
I had the same problem in Visual Studio 2015 with the Solution Explorer always showing empty, even after deleting the ComponentModelCache folder. Looking at the Microsoft.VisualStudio.Default.err file, one of the errors was:
"----- Catalog construction errors -----
Error #1
Microsoft.VisualStudio.Composition.PartDiscoveryException: Failure while scanning type ......"
Doing a Google search on Microsoft.VisualStudio.Composition.PartDiscoveryException lead me to a Nuget package for Visual Studio MEF. Since I read so many posts of people have this same problem, I figured the problem was with Visual Studio and not necessarily any particular extension. So I installed this Visual Studio MEF Nuget package, restarted Visual Studio, and now the Solution Explorer is populated every time.
Nuget: https://www.nuget.org/packages/Microsoft.VisualStudio.Composition/
Deleting the .suo file worked for me.
Close VS, delete suo file of your project (is hidden), open your project again.
I had this problem with two projects, this fixed it in both cases.
Also, creating a new project (in my case a Console Application) also worked! That was probably the easiest fix i've found thus far and you don't have to delete anything! Nice...
Go To Window menu in visual studio and click reset window layout...it will work

Are you missing a using directive or an assembly reference error when all other dependent projects compile

Please watch this screencast as a video would say a thousand pictures:
https://dl.dropbox.com/u/84476328/ShareX/2013-10/2013-10-26_06-49-48.mp4
I recently installed Visual Studio 2013 and attempted to compile a perfectly working Visual Studio 2012 solution.
Start-up project is ShareX and I can compile all other dependent projects as shown in the screencast. When it gets to compiling the main project, it fails.
I have no idea how this could happen.
All projects are on .NET Framework 3.5.
Entire solution was fully compilable in Visual Studio 2012.
I have removed references and re-added them to no avail.
Appreciate any pointers in the right direction.
It turned out to be a problem with Nuget. The following source code changes in all the csproj files fixed it. I am linking it for future reference just in case another person stumbles across the same problem:
https://code.google.com/p/sharex/source/detail?r=742
I just experienced this problem as well (Win7, VS2012, C#, WinForms). My solution includes a personal "framework" DLL project that I reference directly, the main EXE project and a UnitTests project. I admit I moved the directory structure around a bit and hand edited the relative paths of the solution in Notepad++. A few builds/hours later I was getting hundreds of errors stemming from the framework DLL project being mysteriously missing.
Here's what fixed the situation for me:
Remove the offending project(s) from the solution.
Save the solution.
Add project(s) back to solution.
Update the project-project dependencies
Update references to the solution's project(s).
Save
Clean
Verify build order
Verify configuration manager
Rebuild solution

Resharper changing Nuget package DLLs when Visual Studio starts

I'm having an issue with my solution, where opening Visual Studio will cause some of my Nuget package DLLs to be overridden.
I've found this only happens when Resharper is installed. Uninstalling it, or suspending it makes the problem go away.
I'm finding that it's only happening for Nuget packages in my local repository, and the overridden DLLs look incomplete (possibly an older version, but still signed as the latest version). Building the solution then fails. I need to revert the DLLs in source control, then build for it to work.
I've tried finding references to old versions of the Nuget package in my solution, but there aren't any.
Does anyone know how to stop Resharper changing my DLLs when Visual Studio loads?
And, any suggestions about what might be the bigger issue with my Nuget packages?
Issue, seems, that you changed your local copy of DLL from package content in packages folder.
It's bad practice. If you need to modify DLL inside some package - you better to create your own package with necessary DLLs.

Android Studio: disabling "External build" to display error output create duplicate class errors

I am starting my migration from Eclipse to Android Studio, and start playing with new projects on Studio.
My test project was working fine till I got some errors messages.
I had to do some manipulation (https://stackoverflow.com/a/16876993/327402) to enable the error output to display, and found the issue that I fixed.
Unfortunately, after this "workaround" (Why the hell have I to make such things to see my errors?), I found that there was an error message that I cannot fix:
error: duplicate class: com.mypackage.name.BuildConfig
error: duplicate class: com.mypackage.name.R
I also noticed that I am not the only one to have this issue (see the comment in the SO answer I linked above)
First time, I was able to fix it by enabling "External build" again, but that happened again, because I needed to see the error output and everything is now broken, and I cannot find what happen.
With Eclipse, the R file was easy to find, in the gen folder, but with Android Studio, there are too many files, and I am a little bit lost.
Any idea/suggestion?
I've found a question like this that has some replies here:
Cannot resolve R.java, duplicate class
You can try this:
Delete the Build folder generated by Android Studio automatically
Also you can try to Rebuild project by clicking Build->Rebuild project after deleting build folder.
So, just to let you know...
A few minutes after I posted my question, Google released an update to Android Studio (0.1.5)
See link: https://plus.google.com/+AndroidDevelopers/posts/Y9vhvGaHCbh
Tor Norbye kindly answered my question in this community, and I am sharing here
So the workaround I quoted in the OP is no more mandatory.
Enabling again External build after upgrading Android Sudio let me see the real errors ( a library and some Gradle import that I fixed)
So, I consider the Android Studio upgrade as the best answer to this question...
Ok, I also have the same problem, and this is what worked for me.
I first unticked external build from compiler settings. Then when I compiled i get two errors related to R.java, duplicate class.
Then i delete the build folder manually from finder. Then rebuild it from android studio, but still same error.
Then I again go back to compiler preference and tick the external build setting, and it worked fine after that.
Looks like some bug.
apparently, or at least for me 0.1.5 has a bug and cannot run in external build
because of some path error you can read about here
https://code.google.com/p/android/issues/detail?id=56628
so i switched to internal building, and then i hit the double R symbol bug
after deleting the build path application is compiled without errors but the build folder is not fully rebuilt, I'm missing the R.java file which the internal builder does not make.
i've rebuilt it on the external builder on an unupdated version as a temp workaround while this issues is fixed.
btw if anyone knows how to tell internal gradle to rebuild the build folder please share.
I just had the same problem and found a way to solve it (You can do this with Android Studio open):
Go to you Android Studio projects folder located in c:\users[USERNAME]\AndroidStudioProjects
Locate your project folder and open it.
Delete the folder named build.
From here, enter your application name folder, where you can find another build folder among with libs and src folders and a file named build.gradle.
RENAME the build folder to build2 or something else.
Now in Android Studio go to Build->Rebuild Project.
And after the project was rebuilt, open again the folder where the build2 folder that you renamed is located.
Delete the new folder named build that was created.
Rename your build2 folder to build again.
Done.

Resources