2013-10-04 73 views
3

我正在尝试构建一个xamarin组件。 我从Binding项目创建了一个SomeLibrary.dll。 使用这个SomeLibrary.dll和组件模板(https://components.xamarin.com/guidelines ),我已经生成了一个SomeLibrary-1.0.xam组件。xamarin组件未能解析程序集

我执行该命令来安装SomeLibrary组件到Xamarin工作室(这样我就可以将其提交到存储区之前测试组件):

mono xamarin-component.exe install /Users/somedeveloper/Desktop/XamarinComponent/component-template-master/SomeLibrary-1.0.xam

(由http://forums.xamarin.com/discussion/5640/test-component-packaging推荐)

现在,我试图测试我的SomeLibrary组件。我创建了一个全新的项目,将组件添加到我的项目中,编写了几行使用SomeLibrary API的代码,并在构建和运行时出现以下错误。 我迷失在这里,感到困惑,任何想法,建议都会很棒。^^。

,我从错误中看到的主要事情是:

error MT2002: Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

这似乎是抱怨某种公钥的。这是什么?我是否必须为我的SomeLibrary组件生成一个PublicKeyToken?如果是这样,我该如何生成一个PublicKeyToken。

感谢,并感谢所有帮助,建议或评论!^ _ ^!

完全错误日志

Building: SomeLibraryComponent (Debug|iPhone) 

Detecting signing identity... 
Provisioning Profile: XXXXXXXXXXXXXXXXXXXXXXXXXXXX 
Signing Identity: "iPhone Developer: XXXXXXXXXX (ALKJLKJSLDKJFLJ)" 
App ID: "SDLFJLKSDJF.SomeLibrarycomponent" 
Performing main compilation... 
/Library/Frameworks/Mono.framework/Versions/3.2.3/bin/mcs /noconfig "/r:/Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll" -nostdlib  "/out:/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/somedeveloper/projects/SomeLibraryComponent/Components/SomeLibrary-1.0/lib/ios/SomeLibrary.iOS.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG;__MOBILE__;__IOS__" /t:exe "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/Main.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/AppDelegate.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.designer.cs" 
Compilation succeeded - 1 warning(s) 

/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.cs(48,24): warning CS0672: Member `SomeLibraryComponent.SomeLibraryComponentViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)' overrides obsolete member `MonoTouch.UIKit.UIViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)'. Add the Obsolete attribute to `SomeLibraryComponent.SomeLibraryComponentViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)' 
/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol related to previous warning) 


Build complete -- 0 errors, 1 warning 

Compiling to native code 
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Users/somedeveloper/projects/SomeLibraryComponent/Components/SomeLibrary-1.0/lib/ios/SomeLibrary.iOS.dll" -debug -sdk "6.1" -targetver "6.0" --abi=armv7 "-v" "-v" "-v" "--compiler:clang++" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe" 
Xamarin.iOS 7.0.1.4 (4cfca2f) Business Edition using framework:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk 
Linking assembly  /Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe into  /Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/obj/iPhone/Debug/mtouch-cache/PreBuild 
error MT2002: Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' 
Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' 
    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, Mono.Linker.LinkContext& context, System.Collections.Generic.List`1& assemblies) [0x00000] in <filename unknown>:0 
    at MTouch.LinkAssemblies (System.String main, System.Collections.Generic.List`1& assemblies, System.String output_dir, Mono.Linker.LinkContext& link_context) [0x00000] in <filename unknown>:0 
    at MonoTouch.Application.ManagedLink() [0x00000] in <filename unknown>:0 
    at MonoTouch.Application.ProcessAssemblies() [0x00000] in <filename unknown>:0 
    at MonoTouch.Application.BuildApp() [0x00000] in <filename unknown>:0 
    at MonoTouch.Application.Build() [0x00000] in <filename unknown>:0 
    at MTouch.Main2 (System.String[] args) [0x00000] in <filename unknown>:0 
    at MTouch.Main (System.String[] args) [0x00000] in <filename unknown>:0 

回答

5

它做什么用公钥(标记)。

从您的日志的第一部分看来,您的.dll被命名为“SomeLibrary.iOS.dll”。但是,错误消息正在寻找“SomeLibrary”,而不是“SomeLibrary.iOS”。

文件名和内部程序集名称之间必须存在不匹配。

1

我被困在这里,通过复制一个项目和重命名项目文件从Foundation.MobileMobile。我一直在得到一个“组件未能解决组装”。答案是在项目属性中更改实际的程序集名称。 enter image description here

相关问题