2016-09-18 63 views
0

我在Visual Studio 2015 Pro下使用Xamarin創建Android版聊天應用程序。 我想創建一個物理文件爲SignalR生成的代理描述在這裏:SignalR Hubs API Guide 所以如上所述,我安裝了Microsoft.AspNet.SignalR.Utils NuGet包。 我嘗試:signalr在創建server.js文件時生成錯誤

signalr.exe ghp /path:"D:\WORKS\VISUALSTUDIO\ASPWEBSITE\ServerSignalR_ChatHub\ServerSignalR_ChatHub\bin"

,但它總是給以下錯誤:

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

我在做什麼錯誤或丟失?

回答

0

哦,人....經過大量的研究和嘗試,我終於找到答案。 在錯誤中:

它說,無法加載程序集Newtonsoft.Json,Version = 6.0.0.0。但我有版本= 9.0.0.0 所以我只是強制卸載並安裝最小依賴版本= 6.0.0.0(在我的情況下它取決於SignalR.Core.dll(v2.2.1))。

uninstall-package newtonsoft.json -force 

install-package newtonsoft.json -version "6.0.4" 

,然後運行:

signalr.exe ghp /path:"D:\WORKS\<path>\ServerSignalR_ChatHub\bin" 

併成功產生server.js!

相關問題