I'm creating Chat Application for Android using Xamarin under Visual Studio 2015 Pro. I want to create a physical file for the SignalR generated proxy describe Here: SignalR Hubs API Guide So as stated I install the Microsoft.AspNet.SignalR.Utils NuGet package. And I tried:
signalr.exe ghp /path:"D:\WORKS\VISUALSTUDIO\ASPWEBSITE\ServerSignalR_ChatHub\ServerSignalR_ChatHub\bin"
but it always gives below error:
signalr.exe ghp /assembly:"D:\WORKS\VISUALSTUDIO\ASPWEBSITE\ServerSignalR_ChatHub\ServerSignalR_ChatHub\bin\ServerSignalR_ChatHub.dll"
It generate empty server.js file
What am I doing wrong or missing?
Oh, man.... After lot of research and try I finally found answer. In the error:
It says, Could not load assembly Newtonsoft.Json, Version=188.8.131.52. But I have Version=184.108.40.206 So I just force uninstall it and install it with minimum dependency version=220.127.116.11(In my case it's depended to SignalR.Core.dll (v2.2.1)).
uninstall-package newtonsoft.json -force install-package newtonsoft.json -version "6.0.4"
and then run:
signalr.exe ghp /path:"D:\WORKS\<path>\ServerSignalR_ChatHub\bin"
And it generate server.js successfully !!
I thought I would add my solution which uses the "pre-build event command line" in Visual Studio under the project properties "Build Events". Instead of playing with the installed packages for my program (which works perfectly fine otherwise), I put a copy of the old NewtonSoft files in an "OldNewton" directory at the Solution Folder level. I noted the install directory for the SignalR.Utils executable files. Then I scripted some commands to change to the bin folder, copy in the old NewtonSoft files and the Utils files, execute the signalR ghp command to create the hub script, then copy the file to where I wanted it. I also added some cleanup commands and some commands to backup/restore any existing NewtonSoft files. You might want to copy the SignalR.Utils files to their own directory next to the OldNewton files in case the package gets updated. I think it looks a lot more complicated than it is. You could remove the echo commands and probably even the backup and cleanup commands to make it much shorter. There are a few ways to accomplish this, but this how I chose to do it.
cd $(TargetDir) @echo Creating backup if not exist backup\nul mkdir backup if exist backup del backup\*.* /q /f if exist Newton*.* move Newton*.* backup\*.* /q /f @Echo Copying in the Signal R files copy "$(SolutionDir)packages\Microsoft.AspNet.SignalR.Utils.2.4.1\tools\net40" . @Echo Copying in the old NewtonSoft files copy $(SolutionDir)OldNewton\*.* . @Echo Creating the hub script: signalr ghp /path:$(TargetDir) signalr ghp /path:$(TargetDir) @Echo moving hub file to where I want it: move /Y server.js "$(ProjectDir)scripts\app\srFreedomHub.js" move /Y server.js "$(ProjectDir)scripts\app\srFreedomHub.js" @echo remove the signalR util files and old Newton Files del signalr.* /q /f del Newton*.* /q /f @echo Restore the backup folder files if exist backup\Newton*.* move backup\*.* . @echo Remove the backup folder if exist backup\nul rmdir backup /S /Q
User contributions licensed under CC BY-SA 3.0