WF4在运行时进行编译活动,而在Rehosting Toolbox中看不到MSBuild.exe活动 [英] WF4 Compile Activity at Runtime without MSBuild.exe Activity Visible in Rehosting Toolbox

查看:69
本文介绍了WF4在运行时进行编译活动,而在Rehosting Toolbox中看不到MSBuild.exe活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好WF大师,

在重新安置WF设计师时,我遇到了一个问题,希望能对此提出建议.下面的帖子似乎是在寻求相同的信息.

While rehosting the WF designer I had an issue, which I was hoping for some suggestions on.  The posts below seem to be quests for the same piece of information.

我需要一种方法来允许我重新托管的应用程序的用户创建多个自定义活动或类似于功能"的自定义活动.具有相互参照能力的活动.他们需要表现得与分别定义几个活动的方式类似 文件将放在Visual Studio工作流项目中.我想在重新托管的工具箱中引用这些活动.

I need a way to allow the users of my rehosted application to create multiple custom activities or "function-like" activities that have the ability to reference each other.  They need to behave similarly to howdefining several activities in seperate files would in a Visual Studio workflow project.  I'd like to reference these activities in the rehosted toolbox.

在上网搜索后,建议的一种方法是做类似代码段的DynamicActivities,当它们掉落到设计图面上时,将其整个内部XAML插入.这对我不起作用.另一个更有希望的解决方案是创建一个 解决方案,并在其中存储活动XAML文件,并使用MSBuild进行编译.这可以与MEF结合使用,以对程序集进行运行时更新,但是我想避免不得不调用MSBuild并在磁盘上创建项目.我宁愿 在运行时生成我自己的动态程序集,并向其中添加我的活动.

After scouring the internet, one way that was suggested was to do snippet-like DynamicActivities that insert their entire inner XAML when dropped on the design surface.  This won't work for me.  The other more promising solution was to create a solution, and store activity XAML files in it, compiling with MSBuild.  This would work in conjunction with MEF for runtime updates to the assembly, but I'd like to avoid having to call out to MSBuild and have a project on disk.  I would prefer to generate my own dynamic assembly at runtime, adding my activities to it.

有没有一种方法可以使用CodeDomProvider在运行时将工作流XAML文件编译为动态程序集? Visual Studio必须以某种方式在后台执行此操作.理想情况下,我希望能够做类似的事情.

Is there a way I can use the CodeDomProvider to compile workflow XAML files at runtime into a dynamic assembly?  Visual Studio has to do this somehow behind the scenes.  Ideally, I'd like to be able to do something similar.

以下是我唯一能找到的相关链接:
http://social.msdn.microsoft.com/论坛/zh-CN/wfprerelease/thread/65503d24-d3b8-4ec4-b4c6-7e456c3c59d5
http://social.msdn.microsoft.com/Forums/zh-美国/wfprerelease/thread/5285db2e-12b3-4512-9127-7662d48c5c2a

有什么想法吗?

Here are the only relevant links I've been able to find:
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/65503d24-d3b8-4ec4-b4c6-7e456c3c59d5
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/5285db2e-12b3-4512-9127-7662d48c5c2a

Any ideas?

-Nick

推荐答案

尼克,
我以前从没考虑过,但是这个想法很有意义,可以使用CodeDomCompiler或Reflection.Emit或类似的方法来生成自己的动态程序集生成器,该生成器动态生成您的Activity子类,并生成所有属性/参数, 发出与VS编译XAML文件时生成的代码类似的代码,从而相应地构造一个构造器,InitializeComponent等.
蒂姆(Tim)

Hi Nick,
I never thought about it before, but the idea makes sense, it could be possible using CodeDomCompiler or Reflection.Emit or similar to generate your own dynamic assembly generator which generates your subclass of Activity on the fly, and generate all the properties/arguments, a constructor, InitializeComponent, and so on accordingly, by emitting code similar to that VS generates when compiling XAML files.
Tim


这篇关于WF4在运行时进行编译活动,而在Rehosting Toolbox中看不到MSBuild.exe活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆