Compile under .Net 3.5

Jul 19, 2010 at 9:05 AM



In the intro article it was mentioned that Caliburn.Micro should be possible to compile under .Net 3.5.


Are there still plans to support .Net 3.5?


I tried compiling myself but everything falls apart because of lack of System.Windows.Interactivity.



Aug 9, 2010 at 4:40 AM

I successfully compiled targeting 3.5 version using   System.Windows.Interactivity Microsoft Expression Blend 3 SDK, but I have to create  to create an Action  delete with 5 parameters in ConventionManager class because is not present in framework 3.5.

public delegate void Action<T1, T2, T3, T4, T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);

I just tested with Hello World WPF application

I would like to use Caliburn Micro with WPF 3.5 application, but I do not know if the first version of Caliburn Micro will require some .net Framework 4.0 or WPF 4.0 features.



Aug 9, 2010 at 2:30 PM
Currently it does not require WPF4 features. There are some methods that use optional parameters, which is a C#4 feature. Other than that, I'm not sure and can't really guarantee that it will remain backwards compatible.
Aug 9, 2010 at 2:32 PM
That said, there's a pretty good chance that whatever I do, you should be able to find a way to make it work, especially since the WP7 version is sort of built on SL3.
Aug 9, 2010 at 4:32 PM

I thought that covarients were used around IResult? I do not think they are backwards compatible either.

Aug 9, 2010 at 11:44 PM
Caliburn.Micro implements coroutines and I don't think covariance has any importance there.
Aug 9, 2010 at 11:48 PM
Thanks for the hint! I didn't know Blend SDK 3 had this library at all. Caliburn.Micro compiles targeting 3.5 without any changes. What I did is I changed target framework to 3.5, referenced Interactive from SDK 3 and CoreEx from Reactive Extensions Framework (it has definition of Action delegate with 5 arguments).
Aug 10, 2010 at 1:10 AM
Sorry my mistake. Thats what I get for going off my memory. However, I did not think that IHandle.cs would compile with its use of public interface IHandle<in TMessage>, but I guess if you just modify it to match the WP7 version which doesn't use it, it would be good. David
Aug 10, 2010 at 5:15 AM

When targeting 3.5, MSBuild compiles it without any problems. I made no changes to Caliburn.Micro sources, just added reference to CoreEx from Reactive Framework (it has System.Action delegate with 5 parameters defined).

In Reflector I see that compiler just ignores "in" and makes it IHandle<TMessage>. Same for default parameter values - another feature of C# 4.0.

Feb 28, 2011 at 3:20 PM
Edited Feb 28, 2011 at 3:20 PM

For anyone checking in with the new Caliburn.Micro 1.0 release I have posted instructions on how to get it to compile against .net 3.5.

Feb 28, 2011 at 4:10 PM
Edited Jun 29, 2011 at 2:10 AM

Update: The latest instructions can be found on the Firegarden software blog.

You can compile caliburn.micro .net on the 3.5 runtime . - Excited to see the Caliburn.Micro 1.0 RC? and like me are living in .net framework 3.5 Sp1 land

Instructions to compile Caliburn.Micro .net 3.5 framework for WPF 

  1. Download the latest Caliburn.Micro .net 4.0 source code.
  2. Change the project to target the .net 3.5 runtime
  3. Remove the reference to System.Windows.Interactivity (to be replaced with the assembly from the Blend 3 SDK)
  4. Add the reference to System.Windows.Interactivity from Blend 3 (You can download this file below).
  5. Add a reference to the reactive extensions framework for .net3.5 sp1 System.CoreEx.dll assembly.
  6. At this point you will almost compile. The problem will be related to a ActionMessage.cs guardPars.Zip() call. See code below.

'System.Array' does not contain a definition for 'Zip'

The following code can be added to fix the error message and get the Caliburn.Micro RC  to compile under .Net 3.5.

static class EnumerableExtension

public static IEnumerable<TResult> Zip<T1, T2, TResult>(this IEnumerable<T1> source1, IEnumerable<T2> source2,

Func<T1, T2, TResult> func){

            using (var iter1 = source1.GetEnumerator())

            using (var iter2 = source2.GetEnumerator())

            { while (iter1.MoveNext() && iter2.MoveNext()) { yield return func(iter1.Current, iter2.Current); } }



Download Required and Compiled Assemblies

To speed up the process you can  download the required 3.5 binaries including the .net 3.5 System.Windows.Interactivity.dll and System.CoreEx.dll along with the final Caliburn.Micro.dll 3.5 build from my website.

If you have any questions please respond to this thread and I will replay asap.

Mar 23, 2013 at 12:01 AM
Just to update this, I needed to download this version of Reactive Extensions to get the System.Threading.dll for the new Task/co-routine integration in 1.5.x to compile under .NET 3.5. I have no idea if any of that stuff actually works though.