Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin component failed to resolve assembly

I am trying to build a xamarin component. I have a created a SomeLibrary.dll from a Binding project. Using this SomeLibrary.dll and the Component Template(https://components.xamarin.com/guidelines ), I have generated a SomeLibrary-1.0.xam component.

I executed this command to install the SomeLibrary component onto Xamarin Studio(so I can test the component before submitting it to the store):

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

(recommended by http://forums.xamarin.com/discussion/5640/test-component-packaging)

Now, I am trying to test my SomeLibrary component. I created a brand new project, added the component to my project, wrote a couple of lines that uses SomeLibrary api, and got the following error as I build and run. I am lost and confused here, any idea, suggestions would be great.^^.

The main thing that I see from the error is:

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

It seems to be complaining about some sort of PublicKeyToken. What is this? Do I have to generate a PublicKeyToken for my SomeLibrary component? If so, how do I generate a PublicKeyToken.

thanks and appreciate any help, suggestion, or comments !^_^!,

Full Error Log

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 
like image 421
xiaowoo Avatar asked Oct 04 '13 18:10

xiaowoo


2 Answers

It has nothing do to with public key (tokens).

From the first part of your log it seems that your .dll is named "SomeLibrary.iOS.dll". However the error message is looking for "SomeLibrary", not "SomeLibrary.iOS".

There must be a mismatch between the file name and the internal assembly name.

like image 57
poupou Avatar answered Oct 16 '22 08:10

poupou


I got stuck here by copying a project and renaming the project file from Foundation.Mobile to Mobile. I kept on getting a "Component failed to resolve assembly". The answer was to change the actual assembly name in Project Properties. enter image description here

like image 3
Warren Schwartz Avatar answered Oct 16 '22 08:10

Warren Schwartz