将 XML 命名空间映射到 CLR 命名空间后,工作流 xoml 文件无法反序列化

发布于 2024-07-26 04:54:11 字数 735 浏览 5 评论 0原文

我将以下属性添加到活动项目中的 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 技术交流群。

扫码二维码加入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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文