I have a Xamarin Forms app that requires me to dynamically load a single one of several possible assemblies at runtime (based on versioning). This should not be a problem as iOS can load assemblies using the mono interpreter. The problem I face is that the IPA and APK packages do not include the assemblies because they are not referenced directly in the app. I include them in the project references but they do not appear in the app package.
Is there a way to tell Xamarin to always include an assembly in the package regardless if it is being directly referenced in code?
==UPDATE==
I have a complete working POC with what I am trying to accomplish in terms of versioning in the application.
https://github.com/rlasker-b2w/XamVersioning
I specifically have to add references in the VersionSelector class otherwise the version projects do not get their assemblies added to the app package.
https://github.com/rlasker-b2w/XamVersioning/blob/main/VersionApp/VersionSelector.cs
I have a Xamarin.Forms PCL project with multiple localizations that are specified in *.resx files and several platform-specific localization files (native for Android and UWP).
This solution is being built using MSBuild. I want to specify languages that will be included in each build. How it can be achieved using MSBuild and standard Xamarin build procedures without modifying *.csproj files before each build?
In Visual Studio 2017, a fresh new Xamarin solution is created with Portable Class Library.
A initial build shows success. But a run gives an error message:
warnings like
Unable to add a reference to project 'App1'. The current project's target is not one of or compatible with the targets of Portable Library project 'App1'.
It is in both App1.iOS and App1.Android.
I have not yet upgrade the Xamarin NuGet package yet. The UWP project can run without any warning or exception.
Look into the project reference on the Android project, we see the broken reference to App1.
Trying to reference that PCL project again, I got
Look into the Property of the App1 PCL project,
What could be wrong? How can I fix the PCL project so it can be correctly referenced by Android and iOS projects?
I'm newbie in Xamarin. I'm using the latest stable version of Xamarin (6.1.4) on my MAC.
I created a Xamarin.Forms project (Forms App) PCL type of project, I checked the IPhone only (Portrait only). It created 3 projects....
ProjectX
ProjectX.iOS
ProjectX.Droid
Now I like to add some .NET assemblies in my ProjectX project to use the webservice or any other .NET assembly like System.Data, system.web.webservice but the strange thing is the list is EMPTY...
e.g. How to add System.Web.Webservices in this ProjectX project?
Is it possible to integrate dependencies from Gradle inside Xamarin project?
A have some libraries, which I need to install, they look like this
dependencies {
compile (name: '<aar fileName>', ext:'aar')
compile 'com.koushikdutta.async:androidasync:2.1.6'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0' compile
}
Can I expose them to Xamarin somehow?
There is no gradle in Xamarin.Android.
To get external libraries or Android libraries you could use:
NuGet
Xamarin Components
Do your own Java Library binding
Convert code directly from Java to C#.
There is a plugin for Visual Studio (tested it a few months ago but didn't worked for me) that in theory grabs dependencies from gradle and tries to convert them to C# Bindings.
Here you have a very good github page with awesome Xamarin Plugins.
Build your Android applications in Visual Studio using Gradle.
With the latest Visual Studio release, if you take a look at the cross-platform C++ section in the File->New project template section, you will see a variety of templates as shown in the figure below. Notice two new Gradle templates that have been introduced.
Source: https://blogs.msdn.microsoft.com/vcblog/2016/06/12/build-your-android-applications-in-visual-studio-using-gradle/
You can try the Java library binding, it's basically creating a C# binding Java library to consume your library from your Xamarin project.
Typically you won't use gradle to build your Xamarin projects. Thus you need to integrate/ reference those libraries through NuGet packages. AppCompat and Support Design are both available as NuGet packages. The otherone, if it does what I think it does, won't be needed because c# as build in async-support.