locked
Cannot install SignalR on Asp.net Core 2.0 MVC VS 2017 15.7.4 RRS feed

  • Question

  • User-1849651236 posted

    Hello,

    I'm trying to Install SignalR into my Asp.Net, Core 2.0, MVC C# Web application in Visual Studio 2017 15.7.4 using this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-2.1&tabs=visual-studio#create-the-signalr-hub

    When I try to run this command in the Package Manager Console:

    npm install @aspnet/signalr

    It gives this:

    npm : npm WARN ChinavasionAPI@1.0.0 No description
    At line:1 char:1
    + npm install @aspnet/signalr
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (npm WARN Chinav... No description:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
    npm
    WARN
    ChinavasionAPI@1.0.0 No repository field.

    and it never installs SignalR.  I don't know if that is an error or just a warning.

    If I try to use Nuget Manager, no matter what version of SignalR I try to install, it seems to install, but the Dependencies shows SignalR with a warning that looks like this:  Nuget packages

    Does anyone know why I can't install SignalR?

    Thanks,
    Tony

    Monday, July 9, 2018 1:21 PM

Answers

  • User-1849651236 posted

    Jannen,

    Thanks for going through the trouble of doing this.  I appreciate your time and effort in trying to help get this resolved.

    I finally got my web application to work this morning.

    What I did is, in Manage Nuget Packages, I went to the Updates link and let it install every suggested update.  That eliminated all of the errors and my application rebuilds without error.

    So now, I have my web application migrated to Asp.Net Core 2.1 and SignalR installed.

    What I need to do now is allow the processing function in my application use SignalR to display progress messages to the user as it updates the files.  I'm really not interested in the chat function.

    Thanks for your help.

    Tony

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 10, 2018 1:12 PM

All replies

  • User-900074593 posted

    Looks like you didnt initiated the NPM before installing signalr libraries.

    Run the following commands

    npm init -y

    npm install @aspnet/signalr

    Npm installs the package contents in the node_modules\@aspnet\signalr\dist\browser folder. Create a new folder named signalr under the wwwroot\lib folder. Copy the signalr.js file to the wwwroot\lib\signalr folder for your application to use it.

    <script src="~/lib/signalr/signalr.js"></script>

    Monday, July 9, 2018 7:24 PM
  • User-1849651236 posted

    Vavjeeva,

    Thanks for your help.

    Yes, I did do both of those steps.  I just didn't say so in my post.  I followed the steps in sequence from that tutorial.

    Thanks,
    Tony

    Monday, July 9, 2018 7:30 PM
  • User-900074593 posted

    Those are warnings from NPM. i also gets that. if you want to remove it, you have to set the private = true in package.json to avoid those warnings. but, thats optional

    "private": "true"

    however, without setting it also, you can still see the signalr libraries in node_modules folder and from there if you put the signalr js file under lib\signar folder and it will work fine. are you getting any error while running the app? if so, share the details to help you.

    Monday, July 9, 2018 8:23 PM
  • User-1849651236 posted

    Vavjeeva,

    I'm sorry, but I disagree.  It compiles with errors.  It can't satisfy this using using Microsoft.AspNetCore.SignalR;, the SignalR Nuget packages still appear with the warning symbols on them as indicated by image from my first post and it cannot find the Hub being inherited.

    Here are the compile errors:

    1>ChvHub.cs(1,28,1,35): error CS0234: The type or namespace name 'SignalR' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)
    1>ChvHub.cs(6,28,6,31): error CS0246: The type or namespace name 'Hub' could not be found (are you missing a using directive or an assembly reference?)
    

    I do not have package.json file anywhere in my solution.

    My solution is an Asp.Net Core 2.0 solution.

    Thanks,
    Tony

    Monday, July 9, 2018 8:56 PM
  • User1751268424 posted

    Hi.

    This code npm install @aspnet/signalr is used in the client side,

    You need to install on server side, that is the error "ChvHub.cs(1,28,1,35): error CS0234: The type or namespace name 'SignalR' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)"
    You can install this server side "Microsoft.AspNetCore.SignalR" using nuget package,

    Then try to run your project. If not run, you may need to migrate to ASP.Net Core 2.1. It's more stable on this version.

    Have fun

    Tuesday, July 10, 2018 2:34 AM
  • User-1849651236 posted

    Jannen,

    Which version of "Microsoft.AspNetCore.SignalR" should I install?

    Thanks for your help.

    Tony

    Tuesday, July 10, 2018 2:41 AM
  • User1751268424 posted

    Tony,

    The are only two versions both are stable. I'm using version 1.0.1 on ASP.Net Core 2.1.1. You can use one of them.

    Have fun

    Tuesday, July 10, 2018 3:02 AM
  • User-1849651236 posted

    Jannen,

    I migrated my solution to ASP.Net Core 2.1.

    I tried to Install the only version available for Nuget Microsoft.AspNetCore.SignalR(1.0.1) and it gave all these errors:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error	CS0234	The type or namespace name 'SignalR' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)	ChinavasionAPI	C:\Users\Tony\Source\Repos\ChinavasionAPI\ChinavasionAPI\ChvHub.cs	1	Active
    Error	CS0246	The type or namespace name 'Hub' could not be found (are you missing a using directive or an assembly reference?)	ChinavasionAPI	C:\Users\Tony\Source\Repos\ChinavasionAPI\ChinavasionAPI\ChvHub.cs	6	Active
    Error	CS0103	The name 'Clients' does not exist in the current context	ChinavasionAPI	C:\Users\Tony\Source\Repos\ChinavasionAPI\ChinavasionAPI\ChvHub.cs	10	Active
    Error		Detected package downgrade: Microsoft.AspNetCore.Http.Abstractions from 2.1.1 to 2.0.3. Reference the package directly from the project to select a different version. 
     ChinavasionAPI -> Microsoft.AspNetCore.SignalR 1.0.1 -> Microsoft.AspNetCore.Http.Connections 1.0.1 -> Microsoft.AspNetCore.WebSockets 2.1.1 -> Microsoft.AspNetCore.Http.Extensions 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1) 
     ChinavasionAPI -> Microsoft.AspNetCore.Http.Abstractions (>= 2.0.3)			0	
    Error		Package restore failed. Rolling back package changes for 'ChinavasionAPI'.			0	
    Error		Detected package downgrade: Microsoft.AspNetCore.Http.Abstractions from 2.1.1 to 2.0.3. Reference the package directly from the project to select a different version. 
     ChinavasionAPI -> Microsoft.AspNetCore.SignalR 1.0.1 -> Microsoft.AspNetCore.Http.Connections 1.0.1 -> Microsoft.AspNetCore.Authorization.Policy 2.1.1 -> Microsoft.AspNetCore.Authentication.Abstractions 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1) 
     ChinavasionAPI -> Microsoft.AspNetCore.Http.Abstractions (>= 2.0.3)			0	
    Error		Detected package downgrade: Microsoft.AspNetCore.Http.Abstractions from 2.1.1 to 2.0.3. Reference the package directly from the project to select a different version. 
     ChinavasionAPI -> Microsoft.AspNetCore.SignalR 1.0.1 -> Microsoft.AspNetCore.Http.Connections 1.0.1 -> Microsoft.AspNetCore.Http 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1) 
     ChinavasionAPI -> Microsoft.AspNetCore.Http.Abstractions (>= 2.0.3)			0	
    Error		Detected package downgrade: Microsoft.AspNetCore.Http.Abstractions from 2.1.1 to 2.0.3. Reference the package directly from the project to select a different version. 
     ChinavasionAPI -> Microsoft.AspNetCore.SignalR 1.0.1 -> Microsoft.AspNetCore.Http.Connections 1.0.1 -> Microsoft.AspNetCore.Hosting.Abstractions 2.1.1 -> Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1) 
     ChinavasionAPI -> Microsoft.AspNetCore.Http.Abstractions (>= 2.0.3)			0	
    Error		Detected package downgrade: Microsoft.AspNetCore.Routing from 2.1.1 to 2.0.3. Reference the package directly from the project to select a different version. 
     ChinavasionAPI -> Microsoft.AspNetCore.SignalR 1.0.1 -> Microsoft.AspNetCore.Http.Connections 1.0.1 -> Microsoft.AspNetCore.Routing (>= 2.1.1) 
     ChinavasionAPI -> Microsoft.AspNetCore.Routing (>= 2.0.3)			0	
    

    Thanks for your help.

    Tony

    Tuesday, July 10, 2018 3:09 AM
  • User1751268424 posted

    Hi Tony,

    It seems your migration was unsuccessful from ASP.Net Core 2.0.3 to version 2.1.1. 

    I understand this is a headache in migration problems. Let me create a SignalR project and you can use it.

    Give me a moment to create the projecr.

    Jannen

    Tuesday, July 10, 2018 3:56 AM
  • User1751268424 posted

    Hi Tony,

    Please download this sample: https://onedrive.live.com/?id=BEAC4EF5DC359963%21114&cid=BEAC4EF5DC359963

    If you just start the project, you may better start from a new project. This is some time is faster and better rather then migration

    Have fun

    Tuesday, July 10, 2018 4:18 AM
  • User-900074593 posted

    you have two options.

    1) Open your csproj file in notepad and change the package reference version to the latest as shown in error log. 

    2) uninstall the nuget package and install it again. make sure you checked include prerelease checkbox as well.

    Tuesday, July 10, 2018 12:52 PM
  • User-1849651236 posted

    Jannen,

    Thanks for going through the trouble of doing this.  I appreciate your time and effort in trying to help get this resolved.

    I finally got my web application to work this morning.

    What I did is, in Manage Nuget Packages, I went to the Updates link and let it install every suggested update.  That eliminated all of the errors and my application rebuilds without error.

    So now, I have my web application migrated to Asp.Net Core 2.1 and SignalR installed.

    What I need to do now is allow the processing function in my application use SignalR to display progress messages to the user as it updates the files.  I'm really not interested in the chat function.

    Thanks for your help.

    Tony

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 10, 2018 1:12 PM