locked
Changes to Assembly strongnames in Xamarin.IOS 6.2.0 RRS feed

  • Question

  • User12 posted

    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

    Wednesday, February 20, 2013 5:46 PM

All replies

  • User151 posted

    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'.

    Wednesday, February 20, 2013 9:51 PM
  • User2589 posted

    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.

    Wednesday, February 20, 2013 10:13 PM
  • User151 posted

    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?

    Wednesday, February 20, 2013 10:58 PM
  • User39 posted

    @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.

    Thursday, February 21, 2013 2:21 PM
  • User151 posted

    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

    Thursday, February 21, 2013 2:53 PM
  • User104 posted

    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?

    Thursday, February 21, 2013 3:33 PM
  • User2589 posted

    @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

    Thursday, February 21, 2013 4:45 PM
  • User151 posted

    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.

    Thursday, February 21, 2013 6:23 PM
  • User39 posted

    @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.

    Thursday, February 21, 2013 11:41 PM
  • User5265 posted

    @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::BooleanobjcmsgSend(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.

    Tuesday, April 2, 2013 9:49 AM
  • User39 posted

    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.

    Tuesday, April 2, 2013 10:10 AM
  • User8796 posted

    it is very cool ,i like this tool

    Tuesday, April 16, 2013 8:50 AM
  • User9953 posted

    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 ???

    Sunday, May 12, 2013 1:48 PM
  • User39 posted

    @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?

    Monday, May 13, 2013 10:08 AM
  • User9953 posted

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

    Monday, May 13, 2013 10:27 AM
  • User9953 posted

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

    I guess it was just my oversight, sorry.

    Monday, May 13, 2013 3:55 PM
  • User841 posted

    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!

    Friday, May 31, 2013 1:17 PM
  • User205 posted

    Rolf, this thread just saved my day!

    Thank you, thank you, thank you ;-)

    Thursday, June 20, 2013 10:11 AM
  • User1288 posted

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

    Thursday, July 25, 2013 3:46 PM
  • User7082 posted

    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?

    Thursday, July 25, 2013 7:23 PM
  • User1288 posted

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

    Thursday, July 25, 2013 8:58 PM
  • User7082 posted

    Tried it but no luck. The DLLs are here: https://github.com/ServiceStack/ServiceStack/blob/master/release/latest/MonoTouch/ServiceStack.Client.MonoTouch-v3.9.55.zip

    Thursday, July 25, 2013 9:12 PM
  • User263 posted

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

    Monday, July 29, 2013 3:58 AM
  • User19062 posted

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

    Monday, July 29, 2013 11:19 AM
  • User5935 posted

    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 nameofyour_assembly.dll

    Tuesday, July 30, 2013 2:19 AM
  • User13824 posted

    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

    Wednesday, July 31, 2013 4:01 PM
  • User7082 posted

    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 :(

    Wednesday, July 31, 2013 6:00 PM
  • User10851 posted

    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)

    Tuesday, August 6, 2013 10:25 AM
  • User7082 posted

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

    Tuesday, August 6, 2013 4:51 PM
  • User14750 posted

    @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?

    Friday, August 9, 2013 3:22 PM
  • User39 posted

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

    Monday, August 12, 2013 8:12 AM
  • User34424 posted

    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.

    Wednesday, January 8, 2014 6:09 AM
  • User34424 posted

    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.b0(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.d20.MoveNext() Sphere10.Framework.iOS

    Wednesday, January 8, 2014 6:50 AM
  • User49009 posted

    Good tool and really very impressive

    Thursday, May 15, 2014 10:28 AM
  • User31867 posted

    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.

    Monday, July 7, 2014 1:44 PM
  • User23133 posted

    @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?

    Tuesday, February 17, 2015 12:45 PM
  • User130765 posted

    @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

    Monday, January 25, 2016 11:18 AM
  • User39 posted

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

    Thursday, January 28, 2016 9:48 AM
  • User341217 posted

    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 enumtype) 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.getConstructorArguments() 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)


    Friday, September 8, 2017 12:31 PM