问题
I'm getting this following error when try to load a workflow from its definition:
Compilation failures occurred:
Line 0: Unable to load assembly 'PI.Shared.WF.Activities.Tests'. Line 581: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Complete results are contained in the Data property of this exception. Please correct the errors in the source and retry the Load.
My code simple loads it from a byte[] memory stream that is the content of the XAML file.
What should it do? This 'PI.Shared.WF.Activities.Tests' project is just a class library that I use to draw the workflows. After that, the file itself is serialized into a byte[] and save on azure storage. When we need to load it, just get the byte[] and pass to:
activity = ActivityXamlServices.Load(new MemoryStream(workflowDefinition.Definition), settings);
Where definition is the byte[] with the file data.
What should I possibly being missing? The 'PI.Shared.WF.Activities.Tests' is not even used anyway inside the Workflow host application.
Thanks
回答1:
Found the problem. It is the PCL libraries that is using fake/facade assemblies that redirects to mscorlib after 4.5 framework and workflow compiler doesn't know(yet) about this.
Have a look on this issue on MS Connect, and there is a workaround there:
http://connect.microsoft.com/VisualStudio/feedback/details/800070/pcl-reference-in-a-workflow-project-destroys-intellisense
来源:https://stackoverflow.com/questions/28198348/failure-compiling-workflow-definition