NuGet doesn't show installed packages - asp.net-mvc

I have MVC 5 project and I use NuGet to install packages. Yesterday I have installed a couple of packages, but today when I run my application I got an error of missing references. I've realized, that my project doesn't have any of references and files that were added from NuGet.I have all this packages in packages folder in my app, but no records about this packages in packages.config file. If I click Manage NuGet Packages in my solution explorer, in online search it shows me all my packages as installed, but in all installed tab it doesn't show me any of them! I didn't do anything since yesterday? What could happened and how to fix all my packages?

I have had this happen from time to time. There are two things that you can try:
Right click your solution in 'Solution Explorer' and select 'Enable NuGet Package Restore'
Close and Reopen VS
Try Rebuild
Otherwise, just uninstall/reinstall each package.
Hope that helps!

Sometime you added new package does't support to your .net framework which is currently active, so active related .net framework as well.

I just have experienced the same problem. In my case, two different versions of a sample package in the packages.config file causing the problem. After removing the older version of the package from the file, VS shows the list normally.

Related

Error: System' could not be found (are you missing a using directive or an assembly reference?) in vs 2019

I tried creating a asp.net core web application with mvc in visual code 2019 and as soon as I open it it showes me a lot of errors like in the picture.
enter image description here
I triend closing and restarting vs, cleaning and rebuilding the solution and restoring nuget packages and it is still not working.
I got similar issue where it was not able to detect the namespaces from .Net library. I uninstalled the SDK and reinstalled it. then it worked !
Check whether .Net SDK is installed properly in your system and do a clean install once again.
Right-click your project name then open the properties windows after that downgrade your Target framework version, build Solution then upgrade your Target framework version which is the latest, and then again Build Solution.
Hope it will resolve your issue.

Package installation error when new blank application in nanoframework is created

When i try create new blank application in nanoframework, i get package installation error.
error message
It seems some problem in nanoframework visual studio extension, my version is NET nanoFramework VS2019 Extension v2019.5.0.8.vsix, but i also tried another versions with same problem.
I have visual studio 2019 community edition and i have installed almost all components.
When i press ok, project is loaded, but is not possible compile it, because there are missing all assemblies. When i try add assembly, theres nothing to add and add nuget packages from nanoframework store leads to error.
when i try this:
pm> Install-Package nanoFramework.CoreLibrary.NoReflection -Version
1.10.1-preview.9
I get this error:
NU1202: Package nanoFramework.CoreLibrary.NoReflection
1.10.1-preview.9 is not compatible with netnanoframework10 (.NETna noFramework,Version=v1.0). Package
nanoFramework.CoreLibrary.NoReflection 1.10.1-preview.9 supports: net
(.NETFramework,Version=v0.0)
similiar when i try another package versions.
So the extensions is installed incorectly, but i cant find why. i tried it more times. uninstall and install again. from extenstion store, and from disc. nothing successfull.
The webserver NuGet released today fixes the issues with the version mismatches.
The issue with VS2019 16.9 remains. Reported to VS Developer Community here. Please up vote to help increase priority.
What is the Community version you're using?
After a little test, there seems to be an issue with the latest release of VS2019. A work around would be to:
Use V16.8.X
or
use an already created solution that you can edit.
or
add the required nuget to the project once it has been loaded (after the error):
Update: now fixed! it was due to a change to fix nuget, but caused an unintended consequence with nanoFramework.

Update Packages of a MVC Project

Im trying to use an ASP.NET web application downloaded from the internet. Im looking for a way restore all the dependencies/packages in a quick way (clean and building the project did not solve it), rather than installing them via nuget one by one. Is there anyway to download and install/resolve (version issues) all the necessary packages at once?
I tried below package manager console commands, but they did not resolve the package conflicts.
Update-Package -Reinstall,
nuget install packages.config and other solutions here - How do I get NuGet to install/update all the packages in the packages.config?
[resolve/install packages]
Can someone help? Maybe Im using wrong commands or doing something wrong.
If you go into Tools > Nuget Package Manager > Manage Nuget Packages for Solution, it will show a yellow bar at the top asking you if you want to restore missing packages. That's a manual way, but there are also some important VS options you want to look at as well, one being an option to restore packages on build.
There is a generic restore option as well from the package manager console, and that should have worked if it was simply a matter of reimporting the missing packages...
Update-Package -reinstall
You can try to delete the folders, than reinstall using these options. However, is there a possibility there is a .NET framework version mismatch with the version of the DLL's? Maybe some of the DLL's need updated?
Remove package folders from Package folder - don't remove package.config. Next, build you application - nuget should automatically restore all packages.

TFS204018 error when installing NuGet Package in VS2015

Whenever I install a NuGet package in a TFS source-controlled VS 2015 project, I get a message similar to the following output under "Source Control - Team Foundation":
TF204018: Could not check the file's encoding because the file C:\TFS\Oz.Interfaces\Main\Source\MVRSTamperCodes\MVRSTamperCodes.Web\web.config is in use.
I've been searching fruitlessly to see if there's a way to fix this issue and haven't found anything yet. Does anyone know what is causing this message and/or what steps I can take to fix it? I should note that this doesn't prevent the successful installation of the NuGet package so it appears to just be a warning or informational message.
I've met similar issue with blocking web.config and other files. My solution was:
Uninstall NuGet Package Manager (Tools -> Extensions and Updates)
Install newest version (currently: Nuget 3.2)
If you're using Team Foundation Server, you will need to first check out the entire project, before updating Nuget Packages for the project, if you have this problem.

assembly uses System.Web.Http 5.1 which has a higher version than referenced assembly System.Web.Http 5.0

I created a new Project in Visual Studio 2013, a WebApi & MVC 5 project and updated all nuget packages. It updated to mvc 5.1. Now I cannot Successfully build the project it says
assembly uses System.Web.Http 5.1.0.0 which has a higher version than referenced assembly System.Web.Http 5.0.0.0
Anyone run into this before? Why these kind of problems do occur so often in Visual Studio? Does anybody know how to solve this because I really am trying hard but no luck so far...
Solved
I opened the Package Manager Console in Visual Studio and run the command
PM> Update-package
It magically resolved everything for me. You can find Package Manager Console under
Tools
Nuget Package Manager
Package Manager Console
This command deletes all the old packages under the package folder and updates everything if necessary, you may also run the command on a specific package. Here all the variants of the command http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Update-Package
Let me know if you found this useful I'm curious to know if it just happened to me accidentally
A new version of ASP.NET was released. Announcement here : http://blogs.msdn.com/b/webdev/archive/2014/01/20/announcing-the-release-of-asp-net-mvc-5-1-asp-net-web-api-2-1-and-asp-net-web-pages-3-1.aspx
You probably have two projects in your solution, where project A references project B. Both projects reference ASP.NET, but there is a version mismatch.
I had a very similar problem to yours exactly with a reference to System.Web.Http and have documented it here:
Could not load assembly error
When you update a Nuget package it would update dependent packages. But it would not update other packages in your solution that depend on the updated packages. These other packages might not even have a newer version built with the udpated packages.
So the solution is either to udpate all your packages like you did (this might not always work) or add binding redirects to the latest version of your assembly reference to your application config.
I solved this way. As I currently have fwk 4.0.0.0 and don't want to install 5.X:
I removed the referenced DLLs
I removed a couple of bindingRedirects at packages.config,
Then I rebuilded that solution, that throws me errors
Then I added the reference again
And voilĂ , the solution is running with the fwk that I have.

Resources