Changes to Assembly strongnames in Xamarin.IOS 6.2.0

PJBeamanXPJBeamanX USXamarin Team Xamurai
edited January 2015 in Xamarin.iOS

Starting with Xamarin.iOS 6.2.0, assemblies shipped by Xamarin will be signed with a Xamarin key. Prior to this release, the assemblies were either not signed or only delay-signed. This change affects the strongnames of some Xamarin assemblies (Microsoft compatible assemblies strongnames remain unchanged).

Existing user assemblies linking to those assemblies (such as monotouch.dll) should be recompiled using Xamarin.iOS 6.2.0 in order for them to work.

List of changed assemblies for Xamarin.iOS:

Before Xamarin.iOS 6.2.0
MonoTouch.Dialog-1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
MonoTouch.NUnitLite, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null
OpenTK-1.0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
OpenTK, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

Since Xamarin.iOS 6.2.0
MonoTouch.Dialog-1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
MonoTouch.NUnitLite, Version=0.8.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
OpenTK-1.0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
OpenTK, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065

Posts

  • BartSipesBartSipes USMember

    I'm having an issue right now that sounds like it may be related to this change. What a I supposed to do based on what you said?

    In Visual Studio, I get the following error:

    The type 'MonoTouch.Foundation.NSObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

  • SebastienPouliotSebastienPouliot CAXamarin Team Xamurai

    You have an (binary) assembly that refers to the older, unsigned, monotouch.dll. You'll need to rebuild it to reference the new, signed, version of monotouch.dll. After this your project (that use this binary assembly) should build fine.

  • BartSipesBartSipes USMember

    Hmmm, I still get the error after calling clean and rebuild. I've also removed and add the monotouch reference. Still the same error. Any other ideas?

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @Bart: one of the references in your project has not been updated to use the new monotouch.dll. Note that cleaning and rebuilding your project will not fix the reference, you will need to rebuild the reference.

  • BartSipesBartSipes USMember

    Thanks for the input Rolf, but I must be missing something. I don't know what you mean by "rebuild the reference." The only thing that comes to my mind is building the dll from the source code with the signing key which I doubt is what you mean.

    I have three projects in my iOS solution and all three of them reference monotouch with a path of "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v4.0\monotouch.dll". When I open up this dll in Telerik's JustDecompile, it lists "monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065" as the strong name.

    Would you mind elaborating on rebuilding the reference? Thanks

  • ITAdminsITAdmins USMember

    Hi. Is there an upgrade path for 3rd party component vendors, or will we need to provide dlls built against both old and new versions until all our customers have upgraded?

  • SebastienPouliotSebastienPouliot CAXamarin Team Xamurai

    @Bart if you build from source then it won't affect you, i.e. if will get a reference to new monotouch.dll (and it's new strongname).

    What you likely have is a reference to another assembly (binary), e.g. BindingToSomeLib.dll, which has a reference to the older monotouch.dll. You'll need to rebuild BindingToSomeLib.dll so it refers to the new (not the old) monotouch.dll

  • BartSipesBartSipes USMember

    OK, I'm with you now. Yes, I have a TestFlight binding that was built with a reference to monotouch.dll.

    Thanks for explaining that Sebastien.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @RobinSillem: unfortunately you will have to provide both dlls until all your customers have upgraded. The required change is minimal though, and if you have one you can create the other one easily: here is a script that will update the monotouch reference of an assembly.

  • gundorfjangundorfjan USMember

    @Rolf Thanks for providing a link to the script. Being a new to MT, I'm not completely sure how to use this script. Where should I reference it? I have a Facebook.dll which I assume causes this error:

    Linking assembly /Users/jangundorf/Downloads/FacebookConnect-1/FacebookConnect/bin/iPhoneSimulator/Debug/FacebookConnect.exe into /Users/jangundorf/Downloads/FacebookConnect-1/FacebookConnect/bin/iPhoneSimulator/Debug/FacebookConnect.app
    error MT2002: Failed to resolve "System.Boolean MonoTouch.ObjCRuntime.Messaging::Boolean_objc_msgSend(System.IntPtr,System.IntPtr)" reference from "monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"

    How do I rebuild the Facebook.dll with the script, please?
    Thanks in advance.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    Here is a complete project you can use: https://github.com/rolfbjarne/iOSRefUpdater

    Note that this is not supposed to be used in your Xamarin.iOS project, it is a separate program that will modify your third-party assemblies.

  • sunxiaolisunxiaoli CNMember
    edited April 2013

    it is very cool ,i like this tool

  • AndreaSabbatiniAndreaSabbatini ITMember ✭✭
    edited May 2013

    Hi rolf and thanks for the script. I get a 500 internal server error when downloading it but I'll try later again.
    One question though: removing the specific build of monotouch and setting version 0 (managed by xamarin ?) is 'sure' not cause problems ?
    thanks

    [EDIT] I managed to copy/paste the code from the first link and make it work. My question remains because I've noticed that the updated dll is half the size of the first :) . Does it do some pruning too ???

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @AndreaSabbatini: the updated dll should be pretty much the same size. Can you upload your unmodified dll somewhere I can have a look at it?

  • AndreaSabbatiniAndreaSabbatini ITMember ✭✭

    Sure, I'll provide it in the afternoon (CET)
    Thanks

  • AndreaSabbatiniAndreaSabbatini ITMember ✭✭

    WHOPS :) Not sure what happened, it inflated overnight to the correct size hehe.

    I guess it was just my oversight, sorry.

  • SmartyPSmartyP USInsider, University ✭✭

    Thanks a lot for the github project. I had to update a bunch of random libraries (google analytics, flurry, etc.) and the console utility made things simple. Thanks!

  • TonyFonagerTonyFonager DKInsider ✭✭

    Rolf, this thread just saved my day!

    Thank you, thank you, thank you ;-)

  • JonathanNesbittJonathanNesbitt USMember, Beta

    Rolf's command line tool saved me today. Thank you!

  • Jay_UKJay_UK GBMember ✭✭
    edited July 2013

    Xamarin upgrade just killed my ServiceStack Monotouch libraries:

    Error CS0012: The type ServiceStack.ServiceHost.IReturn1' is defined in an assembly that is not referenced. Consider adding a reference to assembly `ServiceStack.Interfaces, Version=3.9.55.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Place.Logic)

    Error CS0012: The type ServiceStack.ServiceHost.IReturn' is defined in an assembly that is not referenced. Consider adding a reference to assemblyServiceStack.Interfaces, Version=3.9.55.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Place.Logic)

    What do I do as I dont want to import the source files and I am developing on a mac?

  • JonathanNesbittJonathanNesbitt USMember, Beta

    @Jay Maybe try dereferencing and then referencing the ServiceStack assembly.

  • VelocityVelocity NZMember ✭✭✭

    Rolf's command line tool worked great for me too.

  • SyrineOuardaniSyrineOuardani USMember

    hi, can you guys help me to know how to use Rolf's solution . thnx

  • DanMiserDanMiser USMember ✭✭

    I'm assuming you pulled the source and were able to compile. The trick is it's a mono executable, so you have to run it like:
    mono iOSRefUpdater.exe name_of_your_assembly.dll

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Note that the ServiceStack binaries on GitHub have not yet been updated for compatibility with the latest version of Xamarin.iOS.

    But it sounds like a quick fix of switching the ServiceStack project type to Xamarin.iOS and recompiling works (thanks Dan Miser!):
    http://forums.xamarin.com/discussion/comment/22240/#Comment_22240

  • Jay_UKJay_UK GBMember ✭✭

    I tried to recompile from the Monotouch solution source using Xamarin IDE but kept getting: "Servicestack.Text.Monotouch (Load failed)"

    I've already lost a few days of development time on this :(

  • maheshmahesh INMember

    I have updated xamarin.ios to 6.4.1.1,I also updated facebook.dll or flurry.dll by using command line tool and previous error has solved but now it is giving following three errors.

    /Users/volgainfotech/Projects/ScrapBoom/Kiln/ScrapBoom-Stable/ScrapBoom.iPhone/ScrapBoom.iPhone/Screens/iPhone/AddDocument/ImageCroppingScreen.cs(38,38): Error CS0012: The type System.Drawing.Size' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012) (ScrapBoom.iPhone)

    /Users/volgainfotech/Projects/ScrapBoom/Kiln/ScrapBoom-Stable/ScrapBoom.iPhone/ScrapBoom.iPhone/Screens/iPhone/AddDocument/ImageCroppingScreen.cs(14,14): Error CS0012: The type System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012) (ScrapBoom.iPhone)

    /Users/volgainfotech/Projects/ScrapBoom/Kiln/ScrapBoom-Stable/ScrapBoom.iPhone/ScrapBoom.iPhone/Screens/iPhone/AddDocument/ImageCroppingScreen.cs(30,30): Error CS0012: The type MonoTouch.UIKit.UIImage' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012) (ScrapBoom.iPhone)

  • Jay_UKJay_UK GBMember ✭✭

    Not sure if this is helpful but I overcame my problems by using the source files rather than DLLs.

  • MarkSeddonMarkSeddon GBMember

    @Rolf
    I've tried using your tool to update the references in the MVVMCross DLLs, but I'm getting this error:

    Error: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.TypeReference.Resolve () [0x00000] in <filename unknown>:0 
      at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.GetConstantType (Mono.Cecil.TypeReference constant_type, System.Object constant) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddConstant (IConstantProvider owner, Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddParameter (UInt16 sequence, Mono.Cecil.ParameterDefinition parameter, Mono.Cecil.ParamTable table) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddParameters (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddMethods (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddType (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.AddTypeDefs () [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.BuildTypes () [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.BuildModule () [0x00000] in <filename unknown>:0 
      at Mono.Cecil.MetadataBuilder.BuildMetadata () [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleWriter.<BuildMetadata>m__18 (Mono.Cecil.MetadataBuilder builder, Mono.Cecil.MetadataReader _) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleDefinition.Read[MetadataBuilder,MetadataBuilder] (Mono.Cecil.MetadataBuilder item, System.Func`3 read) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleWriter.BuildMetadata (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataBuilder metadata) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleWriter.WriteModuleTo (Mono.Cecil.ModuleDefinition module, System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleDefinition.Write (System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0 
      at Mono.Cecil.AssemblyDefinition.Write (System.String fileName) [0x00000] in <filename unknown>:0 
      at AssemblyReferenceUpdater.Main (System.String[] args) [0x00169] in /Users/markseddon/Downloads/iOSRefUpdater-master/Program.cs:81 
    

    Any idea what's wrong here?

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @MarkSeddon: can you upload the binaries you're trying to fix somewhere so I can try this for myself?

  • Herman.0624Herman.0624 USMember

    This happens when you include OpenTK and/or OpenTK-1.

    Xamarin have not even bothered to update their own framework libraries to reference the signed dll.

    What a bunch of noobs.

  • Herman.0624Herman.0624 USMember

    I am getting this error:

    Error 65 The "MangleLibraryResources" task failed unexpectedly.
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
    at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
    at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
    at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table)
    at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method)
    at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
    at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
    at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
    at Mono.Cecil.MetadataBuilder.AddTypeDefs()
    at Mono.Cecil.MetadataBuilder.BuildTypes()
    at Mono.Cecil.MetadataBuilder.BuildModule()
    at Mono.Cecil.ModuleWriter.b__0(MetadataBuilder builder, MetadataReader _)
    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
    at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
    at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
    at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
    at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
    at Xamarin.MonoTouch.Build.Tasks.MangleLibraryResources.EmbedResourcesOnAssembly(String assemblyPath, ITaskItem[] resources, String projectDir, String[] prefixes)
    at Xamarin.MonoTouch.Build.Tasks.MangleLibraryResources.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() Sphere10.Framework.iOS

  • sarahzohar88sarahzohar88 USMember

    Good tool and really very impressive

  • AnilMathpatiAnilMathpati INMember ✭✭
    edited July 2014

    I want to use iTextSharp.dll to generate PDF in my Xamarin.iOS project.
    I am not sure how to update this dll.

    I run the program with below agrument:
    /Users/Anil/Documents/myProject/Sample/bin/iPhone/Debug

    And I get the message:
    No reference needed to be modified. Original file is unchanged.

    But when I try to run my project to generate pdf, I am not able to deploy it to device.
    It is working fine in simulator.

  • KobiShashaKobiShasha ILMember

    @RolfBjarneKvinge

    I've got some .dll that made an error as described (Error CS0012: The type MonoTouch.Foundation.NSObject' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (CS0012))

    I got to this thread, saw your suggestion of the iOSRefUpdater. Compiled it, used it as you mentioned, and the output of the terminal command was "No reference needed to be modified. Original file is unchanged."

    I did, however, get an extra file in the .dll directory, with the same name as the .dll I referenced, with .bak ending. Am I supposed to do something with it?

    What am I missing?

  • D-DD-D USMember

    @RolfBjarneKvinge

    I have same problem with TwilioClient.iOS.dll

    Error 1 The type 'MonoTouch.Foundation.NSObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

    When I used iOSRefUpdater tool,
    I get the message:
    No reference needed to be modified. Original file is unchanged.

    Please Help me to solve it

    Thanks in Advanced

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @D-D: please attach the complete build log.

  • PiyushSrivastava.1708PiyushSrivastava.1708 USMember ✭✭
    edited September 2017

    having the following problem any solution:

    Severity Code Description Project File Line Suppression State
    Error Failed to resolve assembly: 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
    at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
    at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
    at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
    at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection1 parameters) at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute) at Mono.Cecil.CustomAttribute.<Resolve>b__2(CustomAttribute attribute, MetadataReader reader) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func3 read)
    at Mono.Cecil.CustomAttribute.Resolve()
    at Mono.Cecil.CustomAttribute.get_ConstructorArguments()
    at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes(ICustomAttributeProvider provider)
    at Mono.Cecil.ImmediateModuleReader.ReadMethods(TypeDefinition type)
    at Mono.Cecil.ImmediateModuleReader.ReadType(TypeDefinition type)
    at Mono.Cecil.ImmediateModuleReader.ReadTypes(Collection1 types) at Mono.Cecil.ImmediateModuleReader.ReadModule(ModuleDefinition module) at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters) at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters) at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) at Xamarin.Build.Download.XamarinBuildiOSResourceRestore.MergeResources(IAssemblyResolver resolver, String originalAsmPath, String mergedAsmPath, List1 resourceItems)


Sign In or Register to comment.