2013-10-04 44 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

相關問題