Short answer: Probably not.
More longwinded answer:
Note: This applies specifically to CRM 2011 Online.
This week I was creating what I thought would be a nice quick and easy custom workflow activity, however when I first tried to add the activity in the workflow designer I was presented with a
System.Xaml.XamlObjectReaderException, that had the inner fault
System.TypeLoadException, unfortunately CRM didn’t present the inner exception for that.
As a side note; presuming that my code was at fault I unregistered the custom workflow activity, but the error remained (this happened a couple of times). Workflows were not editable and a number no longer functioned in that environment for at least 3-4 hours (I always received the same error described above). After around half a day later the error would disappear and functionality would return to normal – a strange quirk which I assume was linked to some regular event in the system.
So I got on the blower to Microsoft where Maria was kind enough to provide me with the full error log, apparently I was suffering from a
TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib'. That message led me to this StackOverflow question, the gist of which is that running .NET 4.5 code on .NET 4 machines can sometimes go horribly wrong.
Confusingly this MSDN article did state that: “If you plan to register your custom workflow activities with Microsoft Dynamics CRM Online, you must build them using the Microsoft .NET Framework 4 PU3 (platform update 3) or a later version, such as .NET 4.5.”
Which was subsequently updated to: “To develop Windows Workflow Foundation 4 custom activities, you must develop them on Microsoft .NET Framework 4. If you plan to register your custom workflow activities with Microsoft Dynamics CRM Online, you must build them using the Microsoft .NET Framework 4 PU3 (platform update 3) or a later version, such as .NET 4.5.”
The later statement is still pretty confusing if you ask me, so I sought this clarification which was confirmed by Maria from Microsoft.
- The CRM Online servers only have .NET 4 installed.
- We can write code using .NET 4.5 as long as it is all backwards compatible with .NET 4.
- It’s easier to use .NET 4 as compatibility issues can be avoided.