将 XML 命名空间映射到 CLR 命名空间后,工作流 xoml 文件无法反序列化
我将以下属性添加到活动项目中的 assemblyinfo.cs 文件中:
using System.Workflow.ComponentModel.Serialization;
[assembly:XmlnsDefinition("http://Myproject/MyActivitiesLib", "MyActivitiesLib")]*
还在我的工作流运行时 initilize 方法中,我加载了程序集引用,如下所示:
using (WorkflowRuntime runtime = new WorkflowRuntime())
{
TypeProvider provider = new TypeProvider(runtime);
provider.AddAssemblyReference("MyActivitiesLib.dll");
runtime.AddService(provider);
//start workflow
...
}
现在我可以将工作流序列化为 xoml 文件和工作流 xoml 文件中的程序集,匹配 XML 命名空间变化如下: xmlns:msdn="http://Myproject/MyActivitiesLib"
但是,当我尝试反序列化该文件时,出现如下加载错误:
无法打开文件的设计器,因为其中的类它不是继承自可以进行可视化设计的类
I added the following attribute to the assemblyinfo.cs file in the activities project:
using System.Workflow.ComponentModel.Serialization;
[assembly:XmlnsDefinition("http://Myproject/MyActivitiesLib", "MyActivitiesLib")]*
Also in my workflow runtime initilize methold, I loaded assemblyreference as following:
using (WorkflowRuntime runtime = new WorkflowRuntime())
{
TypeProvider provider = new TypeProvider(runtime);
provider.AddAssemblyReference("MyActivitiesLib.dll");
runtime.AddService(provider);
//start workflow
...
}
now I can serialize workflow to xoml file and assembly in workflow xoml file, the XML namespace in match the changes as:
xmlns:msdn="http://Myproject/MyActivitiesLib"
however when I try to deserialize the file , I got an loaderror as this:
Cannot open a designer for the file because the class within it does not inherit from a class that can be visually designed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不太确定您的问题是什么,但我不久前写了一篇关于自定义活动和纯 XOML 工作流程的博客文章,可能会对您有所帮助。 您可以找到它 此处。
另外,为了解决此问题,我建议尝试删除活动并查看何时可以在设计器中打开 XOML 文件。 这样您就可以查明违规活动,这将有助于解决问题。
Not quite sure what your problem is but I wrote a blog post some time ago about custom activities and pure XOML workflows that might help you. You can find it here.
Also to troubleshoot this I would suggest trying to remove activities and seeing when you can open the XOML file in the designer. That way you can pinpoint the offending activity and that will heft solving the problem.