Can't add MonoTouch assembly to NUnit project with Monodevelop - mono

I'm using MonoTouch (monoDevelop 2.6) to develop an iPhone app. I've created an iPhone windows based project, a monoTouch library project and a NUnit project. I'll like to add a reference from my NUnit project, to my library project so that I can write some unit tests against my UI agnostic code.
Sadly, the library and UI projects use the runTime MonoForiPhone and can't be added as references to the NUnit project (which uses the Mono/3.5 target framework).. The projects are greyed out under Edit References with a message "Incompatible framework..."
Likewise if I create a regular .net library for my business logic, the UI cannot reference the project.
How can I create units against my iPhone application?

Add a monotouch library project which contains non UI code.
Add a nUnit project.
Add files to the nUnit project (by creating links).
Now, I can run the at least one of the tests.

What I would suggest is to create two projects, one to target MonoTouch and one which targets .NET 3.5/4/whatever for NUnit testing purposes.

In case you missed it, there is now a NUnitLite runner available for MonoTouch which is designed to work for UI agnostic code and executed on devices (or simulator).
See: .NET Unit test runner for iOS

Related

How to use MSBuild on multiple applications with different targeted frameworks

We have multiple applications using two different targeted frameworks, some are web apps (3.5), and some are winform controls (2.0).
How can we ensure that all the applications are built against their corresponding framework?
Do we have to use the 3.5 version of MSBuild with the 3.5 targeted apps? and MSBuild v2.0 with the 2.0 apps? Will MSBuild auto build against the targeted frameworks unless otherwise instructed?
As long as you ensure you that you are running the highest MSBuild version it should compile all the versions of your Targeted apps. If you are running inside VS then it will take care of compiling this for you. If you are going to directly build all the projects with MSBuild then take a look into
Multi-targeting Overview
https://msdn.microsoft.com/en-us/library/hh264223.aspx and
MSBuild Target Framework and Target Platform
https://msdn.microsoft.com/en-us/library/hh264221.aspx

Can I use my own DLLs with my Xamarin iOS and Android projects?

Can I use my own DLLs with a Xamarin iOS or Android project?
The reason I'm asking is because I want to compile dlls from Clojure CLR, and use them with my Xamarin mobile projects.
Currently the answer for this is 'No' - you cannot use your own existing assemblies but must instead recompile those projects as Xamarin.iOS or Xamarin.Android (MonoTouch or MonoDroid) libraries.
This is because the Xamarin twins are based on old Silverlight profile code and not on full .Net.
This situation is changing currently - Xamarin is rebasing on Mono3/.Net4.5 and Xamarin is working towards PCL support.
However, even with these recent changes I think it is still advisable to rebuild your assemblies for the specific platforms at this time.

MonoDevelop: same project for MonoMac and GTK# possible?

Perhaps my question is totally naiive and this is the reason why I couldn't find any information with Google or something else - but nonetheless, I think it is worth asking here.
I want to develop a C# application which behaves naturally in Mac and Windows (Linux would also be nice, but is not directly needed). My main operating system for development should be Mac OS X and therefore I want to go with MonoDevelop.
I can setup a project for MonoMac - works fine.
I can setup a different project for GTK# - works fine.
My question is now, what I have to do to get a project with a possibility for a MonoMac and a GTK#-frontend. So I will go with the MVC pattern and want to work in one project. As a result, building my project would result in a Mac executable (based on the MonoMac stuff) and one windows executable (based on GTK#).
Am I completely wrong with my approach?
What do I have to do to achieve my goal?
Yes, for a multi-platform app with the best possible look-n-feel on each platform, you would need one executable per platform. Using an MVC approach is the best way to do this - you can have a solution containing a library project with all the shared code - models, processing code, business logic, etc - and a project for each "frontend" executable containing the platform-specific views and shell.
If a really good native experience on Windows is higher priority than Linux support, I'd recommend using WPF or Windows Forms instead of GTK#. This would mean you'd have to split development between Windows and MacOS - you would need to open the same project in Visual Studio, SharpDevelop or MonoDevelop on Windows, and edit the WPF/WinForms project and the shared library there.
OTOH, GTK# has the advantage you could start off writing a single frontend that would work on all three platforms, and then write the platform-specific ones afterwards.

PLCrashReporter framework not working

I am trying to make a sample application (for mac) using the PLCrashReporter framework and the application works fine on my system but the application crashes on the other systems as the systems don't have that framework.Please let me know how to add the framework on other systems through our application.
For this you need to go to Build Phase and then set the destination to framework and drag framework from your Xcode project to copy files and remove it from link Binery with Libraries and now go ahead and make your build it is ready to distribute.......

MonoDevelop 2.6 Beta 1 (2.5.90) Targets .NET 1.0 Framework in Csproj files?

Can anyone tell me why when I create Monotouch projects in the latest drop of MonoDevelop it is targeting the 1.0 framework instead of 3.5, as my projects in earlier versions do? This causes it to not be loadable in VS2010, which I tend to use for coding, while building/testing in MonoDevelop. Here is the version info:
Release ID: 20509002
Git revision: 35a0397615c02f7830d46dfcd31a6c0cb86e9f85
Build date: 2011-04-06 03:37:58+0000
And here is the difference in the csproj files between versions:
Old:
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
New:
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
The v3.5 was a bug; MonoTouch projects never targeted the .NET v3.5 framework. They target the MonoTouch framework, which is arbitrarily versioned as v1.0.
Improvements in MD 2.6 have allowed us to deal with custom .NET frameworks in a similar way to VS 2010. This means that instead of storing the "closest" .NET framework then internally switching it to the correct framework after the project is loaded, we can directly handle particular project types using a particular custom framework.
If you want to load MT project in VS, you already have to make changes to the project - temporarily remove the project flavor GUID (though a trivial VS addin could make that unnecessary). This framework version fix means that you also have to change the target framework to one that VS has. For MonoTouch 4, rather than using .NET 3.5, I would recommend using either Silverlight 4 or .NET 4.
The best solution would be to set VS to actually use the MonoTouch framework, so you'd get accurate code completion and compilation. In VS 2010 that's now possible. Simply set the TargetFrameworkIdentifier of the project to "MonoTouch", then install the custom framework by copying all the MonoTouch framework assemblies to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0 and adding a FrameworkList.xml manifest in the RedistList subdirectory.
I've created a small open source project that enables you to build MonoTouch projects inside Visual Studio 2010. The readme for the project also explains how to get round the "v1.0" problem for the target framework version.
The project is available at https://github.com/follesoe/VSMonoTouch.
Since that's a Monotouch project, nobody expects it to work for Visual Studio or Windows.