How to reference an iOS C++ project into an iOS C# app - xamarin.ios

I created an Android C++ project in VS2017,
referenced the Android C++ project in the C# Android app
and it works fine (it can interop to the C methods from C#).
I'm trying to do the same with iOS.
The C++ iOS project builds fine (using vcremote), but it can not be referenced from the C# iOS project (error message below). This seems to be a limitation of the UI. Is it supported ? If not, what is the workaround ?
The samples on the doc website are only about referencing the iOS C++ project in a C++ iOS app project, not a C# iOS app project.
---------------------------
Microsoft Visual Studio
---------------------------
A reference to 'Comp.AppLib.Native.iOS' could not be added. An assembly must have a 'dll' or 'exe' extension in order to be referenced.
---------------------------
OK
---------------------------

Related

What project type can reference .NET assemblies and can be referenced by an iOS Xamarin app

I'm looking for some help to setup my Visual Studio for Mac project properly. I'm new to Visual Studio Mac and would appreciate a shove down the right road.
I have a large class library, originally developed in visual studio 2017 on Windows.I'd like to use much of that code to develop an iOS application. This class library requires references to:
System
System.Runtime.Serialization
System.ServiceModel
System.ServiceModel.Web
System.Web.
I have tried porting that code to a Portable Class Library in Visual Studio for Mac. However PCLs don't allow you to reference the above assemblies (unless I'm missing something).
So I then ported it to .NET Library project (Other -> .NET -> Library) project. However, my iOS app won't allow references to that project type because VS for Mac says it has an "Incompatible Target Framework: .NETFramework, Version-v4.6.1).
What project type should I be using for this class library so that it can reference the needed .NET assemblies and it can be referenced from my iOS application?
Possible options:
Use a different Portable Class Library (PCL) profile.
Use a .NET Standard project.
Use a shared project.
For everything apart from System.Web, there are PCL profiles that have the assemblies you are looking for. You can see which assemblies are available on the Mac by looking in the PCL directory:
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETPortable
If you open a terminal window there you can run a search, find . -name "System.ServiceModel.Web.dll", or browse the folders using Finder to find a PCL profile that has the assemblies you need.
Another possibility would be to use a .NET Standard 2.0 project which has a lot of assemblies that can be used and supports being referenced by a Xamarin.iOS project. You may need to install some other System.* NuGet packages to provide the required assemblies.
The namespaces available in .NET Standard 2.0 are documented:
https://learn.microsoft.com/en-us/dotnet/api/?view=netstandard-2.0
Another option is using a shared project. This does not have assembly references itself but is basically shared code that is compiled into all projects that reference it. Here you can use #ifdefs for any code that is iOS or Android specific.

Android studio 1.4 Library module with JNI

I'm trying to create an android module with JNI in android studio, but all the documentation I found is for older versions of android studio that did not officially support JNI. So, what is the correct way to create Library module with JNI in Android studio 1.4?
It is exactly same as with 'com.android.model.application'. Everything seems to work fine except that for me, native debugging required running NDK build steps in the app module.

Intellisense not working for WinRT project

I'm using VS 2012 and developing in C#.
I've created a solution with two projects: a WinRT project and a Console Application. For the Console Application I get the intellisense working perfectly. Though for the WinRT project the intellisense does not work.
In the Console Application project if I write "String." the options are showed up, while in the WinRT project they don't.
Any tips or information?

Xamarin 2.0 Iphone resource prefix

I have installed Xamarin 2.0 and i can now starte the iphone simulator from visual studio. I have added another Iphone resource prefix to my project Resources;images
When i run the app from Visual studio the resources in the images folder is not included in the app. If i run it from Xamarin studio on the mac, it all works fine.
Any suggestions on how to fix this ?
This appears to be a bug in the Xamarin.iOS addin for VS. I filed it.

Object Reference compilation error when using Firebase Cloud Communication component for Xamarin iOS

Steps to reproduce:
Create a new xamarin forms app
Build iOS => Ensure it builds successfully
Add the iOS component for Firebase Cloud Messaging for iOS from the component store
Clean, Rebuild => Notice you get object reference error while compiling the iOS project
Here is the error from output window:
"src\RepeatReturns\packages\Xamarin.Build.Download.0.2.2\build\Xamarin.Build.Download.targets(25,3): error : Object reference not set to an instance of an object."
Any idea how can we fix this?
Thanks
UPDATE:
If it helps, I have the linker option for iOS set to "link SDK assemblies only".
If you are using Visual Studio 2017 RC, then I suggest that you stuck with Visual Studio 2015 for the moment, I had the same issue, and I didn't find any solution. So I reinstalled VS 2015, and everything is working now.

Resources