I am making a program in C# WPF with the mvvm-light NuGet package. It worked well for some time but now I get errors on InitializeComponent() of my MainwWindow. When I try to debug, I get deeper and deeper in the program until it says:
"ViewModelBase.cs not found"
ViewModelBase.cs is a file in the NugetPackage of the mvvm-ligth library.
Does anyone know how this is possible/solved?
If you are sure that you correctly added package: Right click on solution -> Restore nuGet packages.
If you are not sure: Right click on solution -> Manage nuGet packages for solution -> Select MvvmLight package and check that package has been installed for the project which is throwing that error (checkbox for that project should be ticked).
Related
I got an error
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
while building my solution. Package manager can't restore my 2 projects:
Unable to find project information for 'C:\(...)\MultiLinker.Courier.Dext.Model.csproj'. The project file may be invalid or missing targets required for restore.
In tools I allow package manage to download packages:
Ran into the same issue. In my case, it was because Visual Studio only had the Offline Package source and could not resolve the packages I needed. I added in the nuget.org source as shown below in the NuGet Package Manager settings and right clicked on the solution and selected restore packages. and it resolved the issue.
open Nuget Package Manager -> Package Source > Add https://nuget.org/api/v2
I might be forgetting some steps, but a crucial step for me to fix this was running nuget restore from the commandline (Trying to restore from Visual Studio UI was not sufficient for some reason).
I also added a plugins folder given to me by a teammate to my .nuget folder that supposedly makes it handle our credentials automatically, so if you are having this issue maybe that is something you are missing as well.
In my case it was my Company DevOps credentials being out of date
Account Settings > Change credentials in the dialog that opens
On Visual Studio Code (VSCode) this can be solved this way:
dotnet new nugetconfig
thank you it works fine
and solved all issues of nuget
by creating the new value in the setting of nuget
under tools > nuget package manger > package manger settings
nuget package sources
add new value nuget.org and https://www.nuget.org/api/v2/
then save and update you project
it will work
The nuget restore did not work for me but once I used nuget.org it worked just fine. This was the best solution for me.
Upgrading my out of date Visual Studio helped for me:
Help Menu: Check for Updates...
I downloaded Newtonsoft.Json.11.0.2 package by package manager console,
and it certainly showed that the package is installed in project.
However, when I try to use the package
using Newtonsoft.Json
visual studio keeps warning me the name is not found and draws red underline.
What should I do? uninstalling and reinstalling the package didn't work.
Make sure you have selected same project while installing package
Add a reference by clicking on your project in the solution explorer with right click -> References -> Newtonsoft Json.
Add it and compile.
Had the same issue, i notice that i have some bll files that have been installed
Microsoft.AspNetCore.Mvc.NewtonsoftJson
Newtonsoft.Json
Newtonsoft.Json.b..
i removed all the files exept 'Newtonsoft.Json' closed the vs.code reopened it and it worked!
After pulling some code updates I found I got this message when building.
Some NuGet packages are missing from the solution.
The packages need to be restored in order to build the dependency graph.
Restore the packages before performing any operations
In solution explorer the references links displayed with a missing reference icon
I deleted the references Then at the package manager console a button appeared asking if I wanted to install the missing packages. However, this did not work.
I am writing this answer as I tried the below solutions but none of them worked :
Clearing the cache
Restoring or re-installing the packages
Changing the targetFramework
Updating the Nuget Package manager
Then I looked upon a dropdown list and it appeared the error was trivial. The package source was offline !! I installed VS2017 professional on my system and opened an existing project and found that multiple packages were missing. I tried everything I could, without looking at Package Source !!
Solution:
Step 01. Go to Package Manager Settings (Tools > Nuget Package Manager > Package Manager Settings)
Step 02. Check the Package Source(s). As you can see, the package source is here already downloaded SDK/nugets/packages. I don't know the reason but the online package source from nuget.org was missing from my system installation of Visual Studio.
Step 03. Install the nuget.org as package source and then 'Clear All Nuget Cache(s)' and then restore the packages. The error will go away.
Name: nuget.org ( or as you wish)
Source: https://api.nuget.org/v3/index.json
When I tried opening the project on its own , outside the solution, and buidling it I received the message.
One or more NuGet packages need to be restored but couldn't be because consent has not been granted. To give consent, open the Visual Studio Options dialog, click on the Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'.
I granted VS the permission, then I ran at the package manager console
update-package -Reinstall
Click Ctrl+Q and write the name of the missing package and then click search for online NuGet package matching .
It will show menu click on browse that will give you the missing package click install ,uninstall or update.
It's possible that folder/zips content error during the first download so go to the Xamarin folder (C:/User/YourName/AppData/Local/Xamarin) and delete or rename or move out the folder of missing nuget or content the of zips folder.
Restart the IDE, your IDE download again the content. I tried this and it works.
I pasted the code from http://www.codeproject.com/Tips/789481/Bridging-the-Gap-between-Linqpad-and-Visual-Studio into Visual Studio 15. It tells me that 'Newtonsoft' could not be found. I open the folder "\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies" and found that the file Newtonsolft.Json.dll is already there. Could anyone tell me how to fixed problem?
Solution Explorer->Right Click on Project Name -> Click on Manage Nuget Packages -> Search for newtonsoft -> Click on install button
Go to Tools -> Library Package Manager -> Package Manager Console
and in the console just write Install-Package Newtonsoft.Json -Version 9.0.1
For me I had the package already installed but it was missing the references and it could not be added.
Helped me: in NuGet Package Manager to downgrade and upgrade Newtonsoft.Json
You have to get the correct NuGet package. From your link:
You can open the NuGet package manager in: Tools -> Nuget Packet Manager -> Manage Nuget Packages for Solution..
I had a similar problem and Google API's had a dependency on Newtonsoft.Json, not allowing me to uninstall Newtonsoft.Json and trying to reinstall.
Removing and and reinstalling Newtonsoft.Json will likely solve the problem, but in my situation, I had to go into Nuget Package Manager -> find Newtonsoft.Json -> select Options dropdown -> check "Force uninstall even if there are dependencies on it".
Checking that box allowed me to remove and subsequently reinstall Newtonsoft and the solution properly referenced it after.
I had the same problem with visual studio 2019. Simply restarting visual studio fixed the issue.
After restarting, the References list in Solution Explorer did show the "Newtonsoft.json".
Right click on the client project side and select Manage NuGet packages.
Then search for Newtonsoft.Json on browse and install.
If the class you are trying to use Newtonsoft is in client you must install the package for the client.
I'm trying to use SignalR with this tutorial:
https://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
but on the stage of debugging I got this:
Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on
this computer. Use NuGet Package Restore to download them. The
missing file is
..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. SignalRChat C:\test\SignalRChat\SignalRChat.csproj 103
Not sure what I have to install and where to download it. So I've installed:
Microsoft.AspNet.SignalR,
Microsoft.AspNet.SignalR.Core,
Microsoft.AspNet.SignalR.JS,
Microsoft.AspNet.SignalR.SystemWeb
first time I have deal with SignalR I did this just strictly according to instructions, so need to figure out
So if I jump through the error, it shows me form, it does not opens localhost to enter user name, opens directly http://localhost:61202/index.html and when I write text and push send message I can't see it display below
So the error says you have a missing signalR package. Try to enable Nuget Package Restore on your solution. There are a few ways of doing this.
Right click on your solution -> Click Enable NuGet Package Restore. Nuget will try to update your missing packages on build
OR
Using your Nuget Package Manager by going to Tools -> Package Manager Console. Then type in Update-Package name of the package
OR
right click your solution, then click Manage Nuget Packages. Under Installed packages, you can search for SignalR just to see if it is really installed.
IF SignalR is already installed, then check to see if it is referenced in your project.
Hope this helps.