Nuget 1.5 -> 16 install issue - nuget

I am running VS2010 Ultimate, I used to have VS Web Dev 2010 Express with Nuget before: I uninstalled it before installing Ultimate.
In admin mode I uninstalled Nuget 1.5 from vs, restarted vs in admin mode, installed 1.6, and then restarted vs. Nuget worked for several days.
The next day, the package manager wont come up - it doesnt give me an error, it just wont load. If I try to uninstall it, the uninstall button is greyed out (which I assume means that the addin is in use). If I restart vs, then I can uninstall.
I have tried uninstalling Nuget and reinstalling it several times (no error messages generated)
Trying to load Package Manager Console and the Package Manager Settings, dont launch anything.
Is there a way to install version 1.5? I've looked for a link but cannot find one.
Is there a log file I can check to see what is wrong?
This has been an extremely frustrating issue for me.
Update:
I used devenv /log, tried to open the package console.
Here's part of the log file:
225 Leaving function LoadDTETypeLib VisualStudio 2011/12/30 21:54:45.181
226 ERROR SetSite failed for package [NuGet.Tools.NuGetPackage, NuGet.Tools, Version=1.6.21215.9133, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a] {5FCC8577-4FEB-4D04-AD72-D6C629B083CC} 80131509 VisualStudio 2011/12/30 21:54:45.196
227 ERROR End package load [NuGet.Tools.NuGetPackage, NuGet.Tools, Version=1.6.21215.9133, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a] {5FCC8577-4FEB-4D04-AD72-D6C629B083CC} 80131509 VisualStudio 2011/12/30 21:54:45.227
228 Warning Package failed to load; error message suppressed by skip flag {5FCC8577-4FEB-4D04-AD72-D6C629B083CC} VisualStudio 2011/12/30 21:54:49.486
229 Entering function CVsPackageInfo::HrInstantiatePackage
Thanks!

Finally got it working: had to delete c:\User Data\\AppData\Roaming\NuGet\NuGet.Config (which was empty) and now it can load.

I had the same problem, nuget worked yesterday but not today with "SetSite failed for package [NuGet.Tools.NuGetPackage" in the VS log.
After a lot of trying and failing I found this page, and then the discussion at http://nuget.codeplex.com/discussions/284604
I followed the advice from bsparkinson there :
Unistalled Nuget.
Searched for nuget in %appdata% and deleted everything
Reinstalled Nuget.
And now it works.

You mentioned:
If I try to uninstall it, the uninstall button is greyed out (which I
assume means that the addin is in use).
Is it greyed out even when you run VS as an admin? The button should only be greyed out if you're not running as admin.
The other thing you should do is try running the following command. You'll need to use the devenv command prompt.
vsixinstaller.exe /uninstall:NuPackToolsVsix.Microsoft.67e54e40-0ae3-42c5-a949-fddf5739e7a5
That should uninstall the NuGet VSIX. After doing that, the following directory should be gone or empty: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\\

Related

Error when installed Xamarin.CommunityToolkit: "The target platform must be set to Windows"

I'm trying to install Xamarin.CommunityToolkit(ver. 2.0.5) from Nuget Packages,
but I get this error message:
So I installed Xamarin.AndroidX.Lifecycle.LiveData with version 2.4.1.1, as it says
then I tried to install CommunityToolkit again, and again I've got the same message but with different compliant.
This time it wants me to install Xamarin.Google.Android.Materia(1.6.0).
I repeated the process a couple of times, and finally I was able to install CommunityToolkit successfully,
but then, when I build the project I get this:
I don't know what should I change to get rid of this error, it was working all fine before I installed this CommunityToolkit package
Here's my .csproj file:
I did try to add "net6.0-windows" to tag with various combinations, but with no effect.
Problem repeats on a newly created project aswell.
I'm using Microsoft Visual Studio Community 2022 (64-bit) Version 17.3.4
For MAUI use CommunityToolkit.Maui package instead of Xamarin.CommunityToolkit.
Official repo
Official docs

Installing Mac VSCode extensions now failing with error: Corrupt ZIP: end of central directory record signature not found

After upgrading work Mac to Big Sur, now unable to install any VS Code extensions, where I was able to before. The error message that I am receiving is the following:
[2021-08-18 14:04:53.663] [renderer1] [error] ["validating: Corrupt ZIP: end of central directory record signature not found"," at x.downloadInstallableExtension (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:54:201021)"," at async x.installGalleryExtension (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:54:197524)"," at async vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:54:194563"]
I have looked at several stack overflow threads like this one:
Error "end of central directory record signature not found" while installing ionide-fsharp in vscode
I can confirm the following:
My company runs a corporate transparent proxy, so I do not have to enter a proxy in the settings. I've confirmed that I do not have this set.
I have followed the instructions to download and install the vsix file manually
Downloading looks to be successful, the python extension is 16.5 MB
The installation portion of the downloaded file fails with the same error
Confirmed that I do not have a disk space issues as someone mentioned in the above thread
I have reinstalled VSCode per these instructions: How to completely uninstall vscode on mac
I've attempted installations of VSCode 1.59 (original version) and 1.58.2, same errors
Any suggestions on where to go from here? I'm not able to install this locally, and can't seem to figure out what may be causing the issue.
I have confirmed with other team members that they're not running into my issue, and they have successfully upgraded to Big Sur. I don't think that's the cause, but that's the only change to my workstation that I can think of.
This worked for me:
Try downloading the vsix file of the extension from its github release page (make sure the extension version is compatible with your vscode version)
Disable your internet connection and install the vsix file via vscode.

Visual Studio 2019 can not get nuget packages

I wonder is there a way to make VS 2019 work with nuget repositories?
Usually it works fine, but sometimes occurs the following.
I pushed a package into my nexus enterprise repository, waited a while (package is already in repo), than opened a .csproj file and entered pushed version. VS cannot load a package with error
Failed to retrieve information about '%packagename' from remote
source
'https://nexus****/repository/nuget-group/FindPackagesById()?id='%packagename'&semVerLevel=2.0.0'.
Of course, if a copy the link to browser, it opens ok. I do have access to both nexus and nuget.org, but VS cannot get any package from them - neither through .csproj nor Nuget Manager UI is VS!
Restart machine doesn't matters. dotnet restore also produces the error.
The only thing helpful is to install VS update through the VS Installer.
Today I already installed an update, so I can't do this now.
Is there any way to make this work?
You could try to use nuget.exe to register the source in your machine.
nuget.exe sources Add -Name "source" -Source {Path to the package(s) source}
Then re-start your visual studio.
I looked at Package Manager Output and saw that sometimes a message appeared. The message was someting like 'cannot connect to host because it reject or already has a connection error at xxx.xxx.xxx.xxx'. (My dirty translate from Russian)
But the point is: this IP is neither nexus host nor any intermediate host. I found that is was our old enterprise proxy (because the new one had no access to nuget.org), which is obsolete and unsupported. So, I just deleted proxy section from %APPDATA%/Roaming/Nuget/Nuget.config and at least local nexus became always available for me.

Error on installing ASP.NET Identity 2 Samples

I'm trying to install ASP.NET Identity 2 samples project. I open Visual Studio 2013, create an empty ASP.NET project, open Package Manager Console and type:
Install-Package Microsoft.AspNet.Identity.Samples -Pre
After some time of installing it returns an error:
Unable to uninstall 'jQuery 1.10.2' because 'bootstrap 3.0.0' depends on it.
Ok, I type the installation command again. This time the error is:
Failed to add reference to 'System.Net.Http'. Please make sure that it is in the Global Assembly Cache.
All subsequent attempts to install finish up with the same error.
UPD: I have installed the samples successfully using "Manage NuGet Packages" UI. Still interested why it have not worked in console? Have I done something wrong?

The term 'Update-Database' is not recognized as the name of a cmdlet

I am using EF5 beta1 and while I was able to run the "Update-Database" before. Now that I shut down Visual Studio, I cannot get it to run. I get the following error:
The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ Update-Database <<<< -verbose
+ CategoryInfo : ObjectNotFound: (Update-Database:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have tried to re-install EF5b1 and while was successful (already installed), the 'Update-Database' still does not work.
Can anyone help???
The solution is to close the Package Manager Console, close Visual Studio and then reopen them.
Rebooting also worked most of the time, but not always.
If you use Entity Framework:
Error Message:
"Error Message (from the Update-Database command in the PMC):
The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
Solution:
Exit Visual Studio. Reopen project and try again.
For more information please visit: Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12)
For anyone who is using .Net Core and EntityFrameworkCore:
You will need to install Microsoft.EntityFrameworkCore.Tools package to resolve this issue.
Read more here: https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
Reinstalling the nuget package fixed this issue for me
ie, execute
Install-Package EntityFramework -Version 5.0.0
in the package manager
Sometimes when I load VS, I see this in my package manager console:
Value cannot be null.
Parameter name: path1
I have no idea what causes that yet but it seems that something goes wrong during the start-up of the Powershell console which interrupts the registering of specific modules, such as the EF powershell extensions. You can just manually load it however:
Import-Module .\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1
Make sure you replace 6.1.1 with whatever your current version of Entity Framework is.
you will get this error when the EF tools are not installed properly.
try the below command in Nuget package manager
//Uninstalls and install the same Version of EF
Update-Package "EntityFramework" -reinstall
If you still face the same issue.
create a new Web Project and run the below command in nuget.
(Note : no need to create the new Project in the same solution or
same location.)
// This will update EF to latest version(including the tools)
// if you want to use specific version , use the -version flag.
Update-Package "EntityFramework"
Once this is done, chcek your original project and you can delete the newly created project.
Just restart Visual Studio, it'll solve the problem. Works for me.
Install Microsoft.EntityFrameworkCore.Tools solved the issue for me, used nuget packages
I solved this by uninstalling and reinstalling Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Tools
I had this same problem, and the origin of it was on my path name, I had on my path a directory name with straight brackets, like this: C:\[PROJ]\TestApp.
When I removed the brackets, to C:\PROJ\TestApp, it started to work just fine...
Just ReOpen visual studio is work for me
For me the problem was the Nuget version.
uninstall Nuget Package Manager.
restart Visual Studio.
installed new version of Nuget Package Manager.
then re-start Visual Studio again.
This problem seems to happen when you open the project directly from File Explorer. Try starting VS first and then opening the project - worked for me. I'm guessing this is about access to paths.
Most of the time those beta versions have some issues, also if Entity Framework failed to load and also this can happen if you are install the Microsoft.EntityFrameworkCore.Tools globally. try to install it locally into your project
. you can try these steps until you fix the issue. and remember this method is not to fix the issue this is the other way to do this.
cd in to your project directory. not the sln directory to the project directory.
then dotnet ef to find out that you have correctly install the Entity Framework.
then use dotnet ef migrations add "ReplaceThisWithSomeText" command. And this will create new migration.
then use dotnet ef database update to update the database.
Migrations Overview. This will helps too..
Windows commands - cd
(This Is for EFCore projects)
If the other answers don't work (VS 2017): clear the NuGet cache, restart VS, then restore the packages.
I found that it was due to a corrupt package. I had installed Automapper when it was already installed. It was only clear that this package was corrupt when I tried to install another package.
Removing the corrupt package solved this issue for me.
You can then reinstall automapper. The issue was with version 5.4, I am now happily on 6.0.
For me it turns out EntityFramework core was not installed on my project (because i started with blank project). So installing EntityFramework package resolved the problem. Sometimes if EntityFramework installation failed then try to install individual packages one by one
E.g.
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.SqlServer.Design
Microsoft.EntityFrameworkCore.Tools
I solved by updateing Package Manager Console.
I was not getting Update-Database in Package Manager Console. Then i restart several time. Also restart Windows.
Then I download new one from nuget and then it was solved.
I had this problem in Visual Studio 2015 and resolved it by updating the version of Nuget.
Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery
Simple fix for me was to make sure there was a dash between update and database, like this: update-database and use lowercase. It may be coincidental, but when I did this in Packet Manager Console, the database actually updated and I got the done message rather than the not recognized as the name of a cmdlet, function, script file error.
I started having the same issue after I accidentally opened a Visual Studio solution with Visual Studio 2015 instead of 2017. The project worked just fine before that mishap. It was an older project with EF 5.0 and not EF Core.
I tried everything suggested - restarted Visual Studio countless times, cleaned up NuGet cache, deleted everything in packages folder, reinstalled EF 5 for the project - no good, add-migration was not recognized. If I upgraded EF to 6, it started to recognize the commands, but I did not want to upgrade yet. So, as soon as I reverted back to EF 5, the problem returned.
The only thing that finally saved me was to do the following:
close Visual Studio
delete everything from packages folder
delete .vs folder in the root of your solution. This folder is usually hidden, you have to turn on Show hidden files and folders setting or check Hidden items in folder View tab
start Visual Studio and open your solution. It will ask to restore NuGet packages, agree to it.
Now EF commands finally started working again.
In my case:
Reload project did not help
Restart VS did not help
Restart computer did not help
Reinstal EF did not help
But I found an article where suggestion was to manualy import missing EF package, using PM Conole:
Import-Module .\packages\EntityFramework.X.X.X\tools\EntityFramework.psm1
And this solution solved my problem.
In my case restarting Visual Studio (many, many times) did not work, then as I was looking elsewhere I found a message on the output terminal:
The current .NET SDK does not support targeting .NET Core 2.2. Either
target .NET Core 2.1 or lower, or use a version of the .NET SDK that
supports .NET Core 2.2.
So I installed the required version of .NET Core and the command ran successfully.
I had this problem in VS 2019 with an existing project using EntityFramework 6.3.0. This project had some strange version changes done to it over a period of time, and nothing would get it working. I believe I tried every suggestion listed here with no luck.
Finally, updating to the pre-release version of EntityFramework (currently 6.4.0-preview3-19553-01) did fix the problem, by running this in the Package Manager Console: Update-Package EntityFramework -prerelease. I'm hopeful that when this version is released live in the next few weeks it will work properly.
In my case, I did the following:
- restored missing NuGet packages by clicking "Restore" button on top of the Package Manager Console
- restarted Visual Studio
- run update-database
Restoring NuGet package didn't help me.
I had to reinstall package manager - https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
For me the problem was the Nuget version.
I removed and re-installed Nuget then re-started Visual Studio and then all started working.