Can I build Binding Projects in Visual Studio? RRS feed

  • Question

  • User214 posted

    When I link a native library (.a) file, is it possible to build these in Visual Studio with the new Add-In? It seems that the compiled file it way too small (no linking of the .a file).

    Thursday, February 21, 2013 2:14 PM

All replies

  • User1497 posted

    Yes you can, just add your library (.a) as a EmbeddedResource and and use LinkWith on your AssemblyInfo.cs

    [assembly: LinkWith("libFoo.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.ArmV7s, Frameworks = "Foundation", ForceLoad = true)]
    Thursday, February 21, 2013 4:01 PM
  • User214 posted

    Jarina, as far as I can see, this is NOT working! Have you actually tried this?

    To start with, if you create a new Binding Project in Visual Studio and a new Binding Project in Xamarin Studio Mac you get two complete different definitions.

    Visual Studio:

    Xamarin Studio:

    Also the MSBuild targets are different

    Visual Studio:

    Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets"

    Xamarin Studio:

    Import Project="$(MSBuildExtensionsPath)\Xamarin\Xamarin.ObjcBinding.CSharp.targets"

    When building in Visual Studio (with Embedded Resource) the DLL is useless. Nothing found in it to work with.

    When I do the same in Xamarin Studio, the DLL is usable. Also the Build Action is set to ObjcBindingNativeLibrary instead of Embedded Resource.

    If I try to load the working project in Visual Studio, it complains that's an incompatible project type and the project does not get loaded.

    It seems this is a Bug in the Visual Studio Xamarin.iOS plugin.

    Friday, February 22, 2013 2:38 PM
  • User1497 posted

    Hi @StefandeVogelaere

    I've made a simple sample calling a native method from a library.


    I made the BindingFoo library using the regular iOS Library template, and I've added the library as a EmbeddedResource with a LogicalName libFooiOS.a

    If this still does not work for, you still can build the binding library on XS and use this library on Visual Studio.

    But we shall improve the ObjCBinding for the next release on Visual Studio.

    Thank you.

    Friday, February 22, 2013 3:51 PM
  • User7021 posted

    Hi, We have the same problem and I have tried your fix only for Visual Studio to generate a different set of complier errors. I have created and included a small Visual Studio project which reproduces this error.

    The included Visual Studio project is run on Windows 8 using Visual Studio 2012.

    Could you please give me an estimate when the new Visual Studio plug-in will be released?


    Wednesday, March 27, 2013 11:33 AM
  • User7021 posted


    Any update on why the attached project will not build with a project that includes an Objective C file?

    Wednesday, April 10, 2013 12:40 PM
  • User1497 posted

    Hello @Al

    What exactly is your issue? Your project is building fine here. Remember you cannot create the .a library on Windows only on Mac

    Wednesday, April 10, 2013 8:48 PM
  • User1100 posted

    I am having exactly the same issue. I have not made the last changes suggested by Jarina. I'm currently working with Bryan from Xamarin support. Binding projects created in XS are not compatible in VS. VS created projects don't work for me. Binding namespace is not visible when using a project reference. Does not work either referencing a binary created in XS. No workaround at present if working in VS. Generally ok in XS but we have Xamarin.IOS business edition because we want to code in VS using Resharper etc.

    Wednesday, April 10, 2013 10:30 PM
  • User1497 posted

    Hello @GrahamMoore

    Did you tried this approach http://forums.xamarin.com/discussion/comment/5371/#Comment_5371 ?

    I am building here with XS and VS without any problem.


    Thursday, April 11, 2013 3:51 AM
  • User1100 posted

    Hello @Jarina I downloaded your sample. Had trouble with building the library using MAKE. So built manually and added to the sample project. Everything built OK but when I executed the sample I got System.EntryPointNotFoundException thrown.

    Thursday, April 11, 2013 11:22 AM
  • User7021 posted


    We are trying to use Visual Studio 2012 running on Windows 8 linked to a MAC to run the iPad simulator. Our code is held in Team Foundation Server (TFS) via Visual Studio (VS). Using the Xamarin VS plugin we have built a new project which will not build on Windows 8 via VS. The project we supplied was a demo of our large project, which will not build? Did you build the project on a MAC?


    Thursday, April 11, 2013 2:25 PM
  • User1497 posted

    Hello @GrahamMoore

    What trouble? Can you gist your output ?

    Thursday, April 11, 2013 5:20 PM
  • User1497 posted

    Hi @Al You need to perform the native build on the Mac, you cannot build the .a on a Windows machine.

    Take a look here for a example: http://screencast.com/t/YP6V4YVfL (building on XS and VS)

    Thursday, April 11, 2013 5:29 PM
  • User17 posted

    Just to clarify: the binding project type is not fully supported in the VS plugin. This should be fixed in a future release.

    In the meantime, you can use Jarina's suggestion for linking a native library. Or as a simpler but more troublesome solution, you can build your binding project in Xamarin Studio and reference the DLL in your VS solution.

    Thursday, April 11, 2013 5:53 PM
  • User1100 posted

    Hi @Jarina

    MAKE output is at:


    Thursday, April 11, 2013 11:10 PM
  • User1100 posted

    Hi again @Jarina and @bmoulton

    One of the original options I tried was to create a binding library in XS and compile to binary. Then reference this DLL in a VS project. When I originally tried this none of the namespaces in the binding library were visible, both in the using statements and also in object browser. So the project would not build. I have re-tried this option and now I can successfully see the namespaces and everything seems to be referenced correctly.

    Will do some more testing to ensure all OK.

    As regards the other native binding option, the documentation is a bit light on for this option so I wouldn't be confident of getting a working library in a short period of time.

    Thursday, April 11, 2013 11:40 PM
  • User1497 posted

    @GrahamMoore Looks like your Mac is not using llvm-gcc from Xcode, if you installed your own gcc (brew, ports), try to reset your environment to use the built-in gcc (or you can try to build the .a from Xcode)

    Friday, April 12, 2013 4:01 AM
  • User1100 posted

    Thanks @Jarina for taking the time to look at that. I did install MacPorts some time ago but never really looked at it. I didn't realise it came with its own gcc. I'll take a look and figure out how to switch it back to the Xcode gcc.

    Friday, April 12, 2013 4:12 AM
  • User7021 posted

    Bryan's solution fixed our build problem.

    Many thanks Jarina and Bryan.


    Friday, April 12, 2013 4:00 PM
  • User292 posted

    Just found this thread and it looks like it's describing exactly the problem that I have been trying to solve for 2 days. Sent an email to Xamarin support describing the problem. The reply was useless. My counter-reply has not been answered in the last two days.

    I have been trying to build the Route-Me sample. The binding project for libMapView.a doesn't load. Made a new binding project. Built it and the DLL was really small. Finally figured out that build action had to be Embedded Resource. Now the DLL is about the size one would expect. My app that references the DLL will not build. It doesn't see the bound references.

    Tried building in Xamarin Studio and it simply does not load the solution at all. Gives me Unknown solution type 6BC8ED88... (can't do a copy to clipboard in the XS Errors output... WTF?). Looks like I don't have iOS in XS on my Windows machine, so now I have to hunt around for the Windows installer so I can build the binding project. Then I have to go back to VS2012 to build the real project.

    This is completely bogus. I have a lot of code to write in a short amount of time and the last thing I need right now is to spend 3-4 days on something like this. We are porting our already shipped Android app that we did with MonoDroid to iOS. At this rate, it may be faster to learn Objective-C and do a complete manual port.

    Please help. Quickly.

    Thursday, May 2, 2013 3:54 PM
  • User292 posted

    Do I have to build my bindings project in Xamarin Studio on the Mac and then copy the DLL back to the PC to build my project? Please say it aint't so.

    Thursday, May 2, 2013 4:07 PM
  • User292 posted

    Never mind. Created the DLL on the Mac, copied it to the PC and things work now. How long before a real fix?

    Thursday, May 2, 2013 5:27 PM
  • User1497 posted

    Hello @MarkBoettcher

    Why http://forums.xamarin.com/discussion/comment/10294/#Comment_10294 doesn't work for you?

    Friday, May 3, 2013 3:26 AM
  • User292 posted

    Jarina, the link you sent is recursive

    Tuesday, May 7, 2013 8:28 PM
  • User378 posted

    I'm resurrecting this thread for an update: What is the current status of binding projects using the latest Visual Studio extension (version 1.3.250). It looks like it is still broken or unsupported. Are there any plans to support binding projects in future?

    Wednesday, August 14, 2013 7:00 AM
  • User254 posted

    +1 so this can get more attention.

    Would love to see this work asap. The Visual Studio plugin needs more love since there are still way too many tools out there that rely on the Microsoft Development environment.

    Tuesday, September 10, 2013 8:36 PM
  • User2029 posted


    It should at least be written in the head of the xamarin doc page "creating an ios binding lib", that it is supported only on Xamarin Studio on Mac.

    Bryan Moulton: status update ? At least remove the ios binding template from visual studio, you will make us lost less time the first time we encouter the issue ...

    Bryan Moulton April 11 2013 Just to clarify: the binding project type is not fully supported in the VS plugin. This should be fixed in a future release.

    In the meantime, you can use Jarina's suggestion for linking a native library. Or as a simpler but more troublesome solution, you can build your binding project in Xamarin Studio and reference the DLL in your VS solution.

    Wednesday, December 4, 2013 5:04 PM
  • User5953 posted

    great ! great to see more explain ? :)

    Monday, December 8, 2014 11:29 AM