locked
Serializing RuleSet for 2.0 Runtime using .net 4.0 RRS feed

  • General discussion

  • Hello,

    I have an application creating workflow rules using CodeDom. After upgrading to .Net 4.0 the rules are generated just fine but are serialized for 4.0 only.

    I would like to serialize the rules for the 2.0 runtime so 2.0, 3.5 and 4.0 applications can deserialize the rules. I have to compile the application itself in 4.0 so it can load assemblies compiled with the 4.0 runtime. How can I specify the runtime for serializing the rules?

    Thanks,

    D

    • Changed type Andrew_Zhu Monday, December 13, 2010 8:51 AM off topic
    Monday, December 6, 2010 12:07 AM

All replies

  • Hi,

    After some search I found these links could be helpful to you:
    http://blogs.msdn.com/b/lukeh/archive/2007/07/11/c-3-0-and-codedom.aspx
    http://bytes.com/topic/c-sharp/answers/263880-codedom-dll-version

    Regards
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com "Microsoft Windows Workflow Foundation 4.0 Cookbook"
    Tuesday, December 7, 2010 8:17 AM
  • Thanks for responding.  The links you provided apply to compiling I think.  I'm serializing RuleSets to a file.  I had tried updating the config file but that did not help.  I'm not sure if the compiler applies to serialization or if the runtime is hard coded where RuleSets are concerned.

    Just to be clear the following markup shows up in the files:

    <ns0:CodeExpressionStatement LinePragma="{p1:Null}" xmlns:ns0="clr-namespace:System.CodeDom;Assembly=System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    Then it can't be serialized by the 2.0 runtime.  I need to serialize so version=2.0.0.0.  Maybe the solution is in the WorkflowMarkupSerializer with serialization manager overload (just guessing here):

       using (XmlTextWriter writer = new XmlTextWriter(fileName, null))
       {
        WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();
        serializer.Serialize(manager, writer, ruleSet);
       }
    

    Please let me know of other ideas.

    Thanks,

    D

    • Edited by DMarx Tuesday, December 7, 2010 2:32 PM typo
    Tuesday, December 7, 2010 2:31 PM
  • Hi,

    Are you using WF3/3.5. 
    If yes, I would suggest you post this question in WF3/3.5 forum:
    http://social.msdn.microsoft.com/Forums/en-US/windowsworkflowfoundation/threads

    I think many experts in the .NET Framework 4.0 should know more about CodeDom.
    http://social.msdn.microsoft.com/Forums/en/netfxbcl/threads

    Thanks.
    MSDN Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This posting is provided "AS IS" with no warranties, and confers no rights. My Blog: http://xhinker.com
    Microsoft Windows Workflow Foundation 4.0 Cookbook
    Monday, December 13, 2010 8:51 AM
  • I'm using the RuleSet outside the workflow. i.e. System.Workflow.Activities.dll and System.Workflow.ComponentModel.dll both version 4.  The question is not about CodeDom itself.  It is about how the RuleSet and Serializer in WF4 use CodeDom.

    e.g. in using CodeDom to generate the RuleSet I cannot tell the WorkflowMarkupSerializer to use System.CodeDom;Assembly=System, Version=2.0.0.0

    Regards,

    D

    • Edited by DMarx Tuesday, December 14, 2010 3:14 AM Additional Detail
    Tuesday, December 14, 2010 3:02 AM