SignalR references NuGet package(s) that are missing - c#

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.

Related

Can't install discord.net - Failed to retrieve information about 'Discord.Net.Core' from remote source

I have made Python discord bots in the past with discord.py but now I am learning C# and I want to try to make one with discord.net. When I try to install discord.net - I click on dependencies, then NuGet packages, and then browse and search up discord.net. When I press the install button, I get the following error:
Severity Code Description Project File Line Suppression State
Error Failed to retrieve information about 'Discord.Net.Core' from remote source 'https://github.com/DSharpPlus/DSharpPlus/FindPackagesById()?id='Discord.Net.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
I am using Visual Studio 2019.
The issue is that you have used a private nuget feed. In that feed, you have Discord.Net nuget package but some of its nuget dependencies such as Discord.Net.Core do not exist in your private feed. This is the cause of the problem. Remember that nuget dependencies are installed together with the nuget main package. If there is a problem with installing the dependencies, the main package cannot be installed in the project.
So I suggest you should use nuget.org nuget package source.
Suggestion
1) Tools-->Nuget Package Manager-->Package Manager Settings-->Package Sources
check nuget.org source and if your VS did not have it, you can add like this.
2) then under manage nuget packages UI, please select nuget.org to install that package.
============================================
Update 1
Close VS, delete nuget.config under C:\Users\xxx(current user)\AppData\Roaming\NuGet.
Then, restart VS and then installing nuget packages work well.

Some NuGet packages are missing from the solution in Visual Studio Application

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.

NuGet package files missing

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).

Twilio.Api.dll version mismtach with nuget?

In VS2013, I started a new console app and issued a nuget command to pull down the latest Twilio.API.dll (as per the nuget gallery website)
Install-Package Twilio -Version 3.6.27
And I get:
Adding 'RestSharp 105.0.1' to Twilio.
Successfully added 'RestSharp 105.0.1' to Twilio.
Adding 'Twilio 3.6.27' to Twilio.
Successfully added 'Twilio 3.6.27' to Twilio.
...
And I build the console. This puts the dependent DLLs in my bin/Debug folder. When I right-click on the actual Twilio.Api.dll file, and go to the Details tab, it says the product version is 3.4.1.0.
Any ideas on why there is this version mismatch? Does it matter?
Twilio Evangelist here.
A 3.6.27 is the version of the Nuget package, which contains all the references as described above.
What you're looking at is the assembly version for Twilio.Api. that comes from the SharedAssemblyInfo.cs which is hardcoded. You are right however when you think this should change as it should ideally match the package version.
To answer your question though, what is important here is that you downloaded the correct Nuget package, and with that all the up-to-date references, so your project should work without glitches.

'EntityFramework 6.1.3' already installed. Failed to add reference to 'System.ComponentModel.DataAnnotations'

My winforms solution was working, but when I re-opened it, some of the references were no longer working. Hence I removed all the references in the project including the references to microsoft dlls.
Now I am trying to add back the references.
What should I do first?
I tried using package manager to add Entity Framework, but got an error.
'EntityFramework 6.1.3' already installed. Failed to add reference to 'System.ComponentModel.DataAnnotations'.
Now When I open package manager, and select On Line, Entity Framework is ticked. However when I select Installed Packages it states "No packages are installed in the current solution"
When I try to build I get an error message
Error 1 This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is E:\EShared\devnet10\SBD.Scheduling\\.nuget\NuGet.targets. E:\EShared\devnet10\SBD.Scheduling\SBD.Scheduling.Core\SBD.Scheduling.Core.csproj 117 5 SBD.Scheduling.Core
I tried adding a reference to System.ComponentModel.DataAnnotations but it shows in the references with a little yellow exclamation mark.
When I double click the reference icon in solution exporer I get the message
The project cannot be viewed in the object browser because it is unavailable or not yet built
After using version control to revert back to my version with EF6.0.2 , I was then able to install 6.0.3 successfully.
I would still like to know what went wrong.
Close your Visual studio.
From the Start screen, right-click the Windows PowerShell app tile (or search for it in the search bar).
Click Run as administrator (Very Important).
Run this command:
Set-ExecutionPolicy Unrestricted
Now go back to your visual studio and download your Nuget package(s).
Run this command to set it back to secure setting:
Set-ExecutionPolicy Restricted
You can use this command from the Package Manager Console:
Update-Package –reinstall EntityFramework
If you just want to reinstall everything that is defined in packages.config, use this command:
nuget install packages.config
It will also restore the missing packages.

Categories

Resources