Workflow Foundation 4.5“表达活动类型'CSharpValue'1'需要编译才能运行。” [英] Workflow Foundation 4.5 "Expression Activity type 'CSharpValue`1' requires compilation in order to run."

查看:184
本文介绍了Workflow Foundation 4.5“表达活动类型'CSharpValue'1'需要编译才能运行。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过WF45的入门教程,遇到一个看起来别人已经经历过的问题,但与我遇到的问题不同。我希望其他人对我有解决方案。

I am working through the Getting Started Tutorial for WF45 and have run into a problem that looks to have been experience by other people, but not in the same way that I am experiencing it. I am hoping that someone else has a solution for me.

当我学习本教程时,一切都很好,直到必须从工作流主机运行它为止。此时,工作流的实例化失败,并返回以下消息。

When I work through the Tutorial, all is good till I have to run it from the workflow host. At that point the instantiation of the workflow fail and returns the following message.


表达式活动类型'CSharpValue`1'需要在$中进行编译b $ b命令要运行。请确保已编译工作流程。

"Expression Activity type 'CSharpValue`1' requires compilation in order to run. Please ensure that the workflow has been compiled."

我尝试从 Windows Workflow Foundation(WF45)-入门教程,如果我错过了一个步骤,但错误仍然存​​在

I have tried downloading the source from Windows Workflow Foundation (WF45) - Getting Started Tutorial in case I had missed a step but the error still persists.

在线阅读似乎需要遵守带有嵌入式C#表达式的工作流,但是据我了解,使用VS2012和工作流设计器时,默认情况下会发生这种情况?我已经尝试实现在此处找到的CompileExpressions方法,但这没有帮助。我确实读到过,在预发行版本中存在一个问题,其中C#表达式导致了此问题,但VB项目仍然有效。测试一下,我发现我正在遭受这个确切的情况。 VB教程运行正常,但是C#版本由于该异常而失败。

Reading online it seems that workflows with embedded C# expressions need to be complied, but as I understand it this happens by default when using VS2012 and the workflow designer? I have tried to implement the CompileExpressions method found here but that did not help. I did read that there was a problem during the pre-release version where C# expressions caused this problem, and yet VB projects worked. Testing this, I see that I am suffering this exact case. The VB tutorial runs fine, but the C# version fails with this exception.

此外,我敢提:这不是我同事计算机上的问题,所以我认为这是我计算机上的配置问题...

Furthermore and dare I mention it: This is not a problem on my colleague's machine, so I think it is a configuration problem on my machine...

更新和躲闪修复:

因此,尽管我对解决方案不满意,但还是想听听是否有人过得体,所以我设法解决了这个问题

So, I have managed to fix the problem, although I am not happy with the solution and would love to hear if anyone has a decent reason for this happening.

我的解决方法是替换 \Framework myv4中的 Microsoft.Common.targets 文件。 .0.30319 文件夹,其中包含我的同事的同一文件版本。这样就解决了问题。它破坏了什么,还有待观察...

My fix was to replace my Microsoft.Common.targets file in the \Framework\v4.0.30319 folder with my colleague's version of the same file. This has solved the problem. What else it has broken remains to be seen...

推荐答案

原始的问题线程很旧,但也许可以找到

The original Problem thread is pretty old, but may be your find that helpfull either.

我的动态活动遇到相同的问题,发现文档有误:

I had the same Problem with my dynamic activities and found that the documentation is wrong:

这是产生上述错误的代码:

This is the code which produces the error above:

字符串路径= @ myActivity.xaml;

string path = @"myActivity.xaml";

            Activity activity = ActivityXamlServices.Load(path);



            IDictionary<string, object> dictionary = new Dictionary<string, object>
            {
                { "Arg", 1},
            };

            IDictionary<string, object> output = WorkflowInvoker.Invoke(activity, dictionary);

这是工作代码:

字符串路径= @ myActivity.xaml;

string path = @"myActivity.xaml";

            ActivityXamlServicesSettings settings = new ActivityXamlServicesSettings
            {
                CompileExpressions = true
            };


            Activity activity = ActivityXamlServices.Load(path, settings);

            IDictionary<string, object> dictionary = new Dictionary<string, object>
            {
                { "ArgNumberToEcho", 2},
            };

            IDictionary<string, object> output = WorkflowInvoker.Invoke(activity, dictionary);

这篇关于Workflow Foundation 4.5“表达活动类型'CSharpValue'1'需要编译才能运行。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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