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 Utility Version: 2.2.1.0
Creating temp directory C:\Users\vivek\AppData\Local\Temp\aeb9348c-3f99-4537-bed7-7313b3c4bcbe
Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.amd64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.x86.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.amd64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Warning: Could not load file or assembly 'Microsoft.DiaSymReader.Native.x86.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Microsoft.AspNet.SignalR.DefaultDependencyResolver.RegisterDefaultServices()
at Microsoft.AspNet.SignalR.DefaultDependencyResolver..ctor()
--- End of inner exception stack trace ---
Server stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.JavaScriptGenerator.GenerateProxy(String path, String url, Action`1 warning)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.JavaScriptGenerator.GenerateProxy(String path, String url, Action`1 warning)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.OutputHubs(String path, String url, String outputPath)
at Microsoft.AspNet.SignalR.Utils.GenerateHubProxyCommand.Execute(String[] args)
at Microsoft.AspNet.SignalR.Utils.Program.Main(String[] args)
Also tried:
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=6.0.0.0. But I have Version=9.0.0.0 So I just force uninstall it and install it with minimum dependency version=6.0.0.0(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 !!