Does monotouch support multi-file assemblies through modules? - xamarin.ios

I'm creating a cross platform set of applications, and some of the assemblies are constructed as multi-file assemblies using a set of modules compiled under visual studio 2010. Does the monotouch compiler support multi-file assemblies like these?

You can create a MonoTouch Library project to do this, however you will have to compile the library for MonoTouch.
To do this properly, here is an example:
On Windows create 2 projects MyApp and MyApp.Code (a class library project)
On iOS create 2 projects MyApp and MyApp.Code (a MonoTouch library project), in a different folder in your source control, of course
Put all the code into MyApp.Code (Windows version), on iOS "Link-In" every file you want to add the to the project from the Windows copy. This keeps one copy of the file, but allows you to compile for multiple platforms
MyApp will just contain UI-specific code on both platforms and is completely different on both platforms
Add #if IPHONE or #if WINDOWS preprocessor directives anywhere you might need them throughout the MyApp.Code project
Rinse and repeat if you want to do the same for Mono for Android, Windows Phone, etc.

Related

My UWP DLL using WinRT needs VCRuntime140_app and other dlls to be copied into the same folder as the host app

I made a Universal Windows dll (to use the Bluetooth LE features in Win10) which is used by a game engine (Unreal), but when I load this dll at runtime it tries to load some required dlls: vcruntime140_app, vccorlib140_app, and msvcp140_app. I'm assuming these are the UWP based VC++ redistributables. I have VC++ Redist. installed but when I run my application it says it's looking for these dlls, and not finding them automatically.
If I copy these dlls from the SXS folder, it all works but obviously I don't want to ship my application with my copy of these dlls; so my question is why isn't it looking in the Windows associated folders for these files. Does a UWP DLL need a manifest specifying its use of the VC++ redistributable? From what I understand the _App suffix is for UWP application use.

Setup project Cross-Platform with Monogame

I've been trying to figure out on how to setup a Cross-Platform project for MonoGame. Whats the conventional way of doing so ?
Is that done through a Shared Project and can I keep all my content in 1 project ?
Also I am not sure if this information is correct do I need a Mac to build my project for Mac how does that work ? If so how what's the best way of setting that up.
Targeted Platforms : WINDOWS, LINUX, MAC
The best way to setup a cross platform MonoGame project IMO would be to use a Shared project. Shared projects can also include .mgcb file so you won't need to duplicate your content either. How to do:
Use "Xamarin Studio/MonoDevelop" and create a "MonoGame Shared Project" with the name of your game
If you are going to use using "Visual Studio", close the "Xamarin Studio/MonoDevelop" after this, and open up the created project vith it
you are gonna have to include the generated "Content\Content.mgcb" file with build action "None" so it will be visible in Project View area
Add a MonoGame Project for the platform you wish to launch the game from, ie. create a "MonoGame Crossplatform Project" and name it "(gamename).DesktopGL"
Delete "Game1.cs" and "Content Folder" from the Platform project
Add a reference for your Shared project
For your platform project, in options set the Output Assembly Name to be the same as your shared project
this step might not seem important, but if you are using a custom importer/processor this will allow you to not have to compile the content separately for each platform.
There you go, you should be able to run your project now.
Also I am not sure if this information is correct do I need a Mac to build my project for Mac how does that work ? If so how what's the best way of setting that up.
The created executable from DesktopGL project is runnable on Mac even when compiled from Windows, the Mac user just has to launch it using Mono. In case you want you can package your game using MonoKickstart so that your Linux and Mac users don't have to have mono installed: https://github.com/MonoGame/MonoKickstart what's more, it also includes other needed native libraries. Description on how to use it are in the link.
Since you're just targeting Windows, Linux and Mac, you can use Xamarin/MonoDevlop which runs on all three of your target platforms.
Once it's installed, then add the Monogame through the Addin manager. The addin on version 5 of Xaramin and MonoDevlop.
You can then use the same Solution project file between all three platforms assuming you use the OpenGL Template. I use this method for developing between Windows and Linux.
The only time you'll need to use a shared project or something similar would be if you started developing for Mobile (iOS/Android) or for Windows on DirectX instead of OpenGL.

Runtime Component targeting Windows Phone and Windows

I've written a C++ Windows Runtime Component and consume it from a C# Windows 8 app. I'd like to use that same runtime component in a Windows Phone app. Since Windows Phone allows for C++ runtime components, I assumed I could reuse the original runtime component, however it's not targeting Windows Phone right now. Is there some way of modifying my runtime component project to target both Windows Phone and Windows?
I don't want to have to create a separate Windows Phone Runtime Component, duplicate all of the code and maintain two versions.
I'll preface by noting I don't do much coding on the C++ side of Visual Studio, but this should get you close.
You will need two separate projects, but you could set one project up to house all the files and then in the second project Add->Existing Item... to the source/.h in the first project. In C++ (unlike VB/C#) a reference is included to the original location and a copy is NOT made.
I'm presuming #ifdef can be used to work around any differences in the implementation (as is also recommended as an option for C# targeting both Windows 8 and Windows Phone)

How do I change MonoDevelop Target Framework to iPhone for imported .Net library project

I've imported an existing C# library project into a MonoDevelop Solution targeted for iPhone. My original project has a target Framework selection of Mono for iPhone but my newly added project only has Mono/.Net choices. How do I get the iphone targets to show up so I can properly reference it from my existing iPhone targeted projects?
Easiest way I've found is to make a new MonoTouch Library project and either "link" or "copy" the files from the existing project.
This is usually necessary anyway, as usually you will have to add #if MONOTOUCH preprocessor statements in a couple places.

What is the difference between a "Win32 Project", "CLR Empty Project", and "Empty Project" templates in Visual Studio?

I've just recently started working with Visual Studio this summer, primarily on CUDA and OpenCV related projects. Prior to this, I had been doing my development on Linux for CUDA using Makefiles and the common.mk makefile from NVIDIA.
So my question is as follows: I've not been able to figure out for the life of me what the difference between some of the different project templates are. I know that I've had to use "Empty Project" from the general tab of the Visual C++ options, but that's more trial and error, rather than actually knowing what is going on...
A Win32 project is used if you want to end up with a DLL or a Win32 application usually using the bare WinAPI. A common language runtime (CLR) project is used to create C++/CLI project, i.e. to use C++/CLI to target the .NET platform.
The main difference between projects is what Visual Studio comes up with in terms of pre-created files. A windowed Win32 application for example (what you get when you choose Win32 project, but not a DLL) is created with a file for resources (menus, accelerators, icons etc.) and some default code to create and register a window class and to instantiate this window.
When creating a Win32 project, the linker Subsystem is set to Windows. When creating an empty C or C++ project the subsystem is set to console. Likewise the entry point in the settings for Win32 projects expects a WinMain or DllMain while a console expects an int main. A CLR allows you to mix C++ and .NET which is usually discouraged against.
A Windows subsytem can target executables, dlls, libs or driver/native(sys) files. While a console subsystem targets console binary executables. WinMain is typically used when creating an actual Window application using the CreateWindowEx API, establishing message callbacks and inserting a message handler loop.
A console subsustem with int main can also create a Windowed application only you're better off doing it with WinMain.
A Dll empty project sets the subsystem to Windows and setting to the compiled output to (.dll) as well as the entry point to DllMain/APIENTRY and a static lib will do the same as the Dll except it will set the output to (.lib).
Setting the project to Native subsystem will require the Windows Driver Development Kit to compile drivers.

Resources