Xamarin Studio 中找不到程序集错误

Assembly not found error in Xamarin Studio

首先让我说,我什至不确定我正在尝试做的事情是否可行,而且我对 Xamarin/Monotouch 开发还很陌生,但这里是。

对于某些背景,我正在寻找 bi-directional Pusher library. I've found an implementation that receives, but doesn't send. I've used the Pusher.net library before in a Windows app, and it worked well, so I figured I'd try to port it. I'm able to import and compile the actual Pusher assembly as a PCL with with no problems. However when I try to build the Pusher.Connections.Net 库的 Xamarin PCL 版本(同样,作为 PCL),我得到了以下错误:

Target CoreCompile:
    Tool /Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/Pusher.Connections.dll Properties/AssemblyInfo.cs WebSocketConnection.cs WebSocketConnectionFactory.cs /target:library /define:DEBUG /nostdlib /reference:../../../Downloads/WebSocket4Net(0.11)/net45/Debug/WebSocket4Net.dll /reference:../packages/Xamarin.Forms.1.3.1.6296/lib/portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10/Xamarin.Forms.Core.dll /reference:../packages/Xamarin.Forms.1.3.1.6296/lib/portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10/Xamarin.Forms.Xaml.dll /reference:/Users/user/Projects/PusherTest/Pusher/bin/Debug//Pusher.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/Microsoft.CSharp.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Collections.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ComponentModel.EventBasedAsync.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ComponentModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Core.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Contracts.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Debug.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Tools.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Dynamic.Runtime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Globalization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.IO.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.Expressions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.Queryable.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.NetworkInformation.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.Requests.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ObjectModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Resources.ResourceManager.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.InteropServices.WindowsRuntime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Json.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Xml.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Security.Principal.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Http.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Security.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Web.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.Encoding.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.Encoding.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.RegularExpressions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Threading.Tasks.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Threading.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Windows.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.Linq.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.ReaderWriter.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.Serialization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.XDocument.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.XmlSerializer.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/mscorlib.dll /warn:4
WebSocketConnection.cs(94,27): warning CS1998: Async block lacks `await' operator and will run synchronously
WebSocketConnection.cs(24,14): error CS1684: Reference to type `System.Net.EndPoint' claims it is defined assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found
    /Users/user/Projects/PusherTest/Pusher.Connections/../../../Downloads/WebSocket4Net(0.11)/net45/Debug/WebSocket4Net.dll (Location of the symbol related to previous error)
Task "Csc" execution -- FAILED
Done building target "CoreCompile" in project "/Users/user/Projects/PusherTest/Pusher.Connections/Pusher.Connections.Net.csproj".-- FAILED

为了节省一些滚动,关键错误是:

WebSocketConnection.cs(24,14): error CS1684: Reference to type `System.Net.EndPoint' claims it is defined assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found

如果我在 Xamarin 中打开程序集浏览器,似乎引用的 System.dll 确实定义了端点 class。

一个数据点,我不确定是否相关:Pusher.Connections.Net 库依赖于 WebSocket4Net 程序集。如果我尝试通过包管理器添加该程序集,我会收到以下错误:

Could not install package 'WebSocket4Net 0.8'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

但是,如果我只是访问该站点,下载程序集,并添加对它的引用,它似乎满足所有 WebSocket 特定依赖项。

我错过了什么?非常感谢。

EndPoint class is not part of any PCL profile based on looking at the documentation. At the end of the class information it should say whether it is supported in Portable Class Libraries, which it does for the HttpWebRequest class为例。

如果我在 Xamarin Studio 中创建一个 PCL 项目并使用程序集浏览器,System.dll 文件不包含任何 类 但包含一组 TypeForwardedTo 属性,所以我不确定您正在查看 System.dll。

我怀疑您的项目或程序集之一正在使用某些不可用于便携式 Class 库的类型。