Windows Workflow Foundation 4.0 设计器通过自定义活动重新托管

发布于 2024-10-09 14:43:18 字数 610 浏览 3 评论 0原文

我有几个为我公司正在开发的应用程序创建的 WF 4.0 工作流程。其中一些工作流程很简单,有些则非常复杂(即许多步骤、几种不同类型的活动、自定义活动)。对于其中许多工作流程,我创建了多个自定义代码活动来支持某些内部流程类型。

工作流程工作得很好,我们在 VS 2010 中维护它们时遇到了很少的问题。我们现在希望将这一责任转移给我们的业务用户,因此我创建了一个 WPF 应用程序来重新托管 WF 设计器(根据MS 样品)。我的问题是,当我打开包含自定义代码活动的工作流之一时,这些活动显示为红色框,并显示错误消息“由于 XAML 中的错误,无法加载活动”。

我做了研究,发现有几篇文章提到这通常是命名空间和引用的问题。重新托管的设计器位于与此类似的命名空间中:

Company.Application.Workflow.Designer

自定义代码活动包含在单独的自定义工作流库中,我已将其作为参考包含在设计器项目中。该库的命名空间与此类似:

Company.Application.Workflow.Data.Activities

正如我所提到的,该库被设置为设计器项目中的引用,并且在构建项目时我看到它被复制到输出中。我还在主要设计的应用程序的 XAML 中包含了该引用。

我缺少什么?

I have several WF 4.0 workflows that I have created for an application my company is developing. Some of these workflows are simple, and some are very complex (i.e. many steps, several different types of activities, custom activities). For many of these workflows, I have created several custom code activities to support some internal process types.

The workflows work great and we have had very few problems when it comes to maintaining them within VS 2010. We now want to move that responsibility off to our business users, so I have created a WPF application to rehost the WF designer (according to the MS samples). My problem is that when I open one of the workflows that contains custom code activities, those activities are represented as red boxes with the error message of "Activity could not be loaded because of errors in XAML."

I have done research and have found several posts that mention that this is usually a problem with namespacing and referencing. The rehosted designer is in a namespace similar to this:

Company.Application.Workflow.Designer

And the custom code activities are contained within a separate custom workflow library, which I have included as a reference in the designer project. The library's namespace is similar to this:

Company.Application.Workflow.Data.Activities

As I have mentioned, the library is set as a reference in the designer's project, and I see it being copied to the output when I build the project. I have also included the reference in the XAML of the main designed application.

What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

熟人话多 2024-10-16 14:43:18

这里可能有很多问题。其一,您在使用 XamlXmlReader 时是否设置了 LocalAssembly?请参阅此处了解一个例子。另一个问题可能是您的活动加载得很好,但没有找到相关的活动设计器。您还可以使用 AppDomain.CurrentDomain.AssemblyResolve 事件来查看正在加载和失败的程序集。或者更好地使用 Fuslogvw.exe 达到相同目的。

There could be a lot of things wrong here. For one did you set the LocalAssembly when using the XamlXmlReader? See here for an example. Another problem could be your activities loading just fine but the related activity designers not being found. You can also use the AppDomain.CurrentDomain.AssemblyResolve event to see what assemblies are being loaded and failing. Or even better use Fuslogvw.exe for the same purpose.

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