编译工作流定义失败 [英] Failure compiling Workflow Definition
问题描述
尝试从定义加载工作流时出现以下错误:
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.
我的代码简单地从作为 XAML 文件内容的 byte[] 内存流加载它.
My code simple loads it from a byte[] memory stream that is the content of the XAML file.
它应该怎么做?这个PI.Shared.WF.Activities.Tests"项目只是我用来绘制工作流的类库.之后,文件本身被序列化为一个 byte[] 并保存在 azure 存储中.当我们需要加载它时,只需获取 byte[] 并传递给:
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.
我可能会遗漏什么?PI.Shared.WF.Activities.Tests"甚至在工作流主机应用程序中都没有使用.
What should I possibly being missing? The 'PI.Shared.WF.Activities.Tests' is not even used anyway inside the Workflow host application.
谢谢
推荐答案
发现问题.使用伪造/外观程序集的 PCL 库在 4.5 框架之后重定向到 mscorlib,而工作流编译器(尚)不知道这一点.
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.
在 MS Connect 上查看此问题,那里有一个解决方法:
Have a look on this issue on MS Connect, and there is a workaround there:
这篇关于编译工作流定义失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!