Microsoft KB Archive/926504

From BetaArchive Wiki
Knowledge Base

Article ID: 926504

Article Last Modified on 11/24/2006


  • Windows Workflow Foundation


You compile a Microsoft Windows Workflow Foundation solution with one rule in the code and the other defined in the ".rules" file. In this scenario, you may receive a compilation error that resembles the following:

Drive:\test\RuleActionTrackingEventSample\CS\SimplePolicyWorkflow.cs : error WF1342: Activity 'ifElseBranchActivity1' validation failed: Can not find the condition "ConditionName".


This problem occurs because at build time there is no rule defined for the IfElse activity.


To work around this problem, use one of the following method.
Method 1
Specify a placeholder rule at design time, and replace with the desired rule by using code at runtime,
Method 2
Use a code condition. The code condition is based on the same application logic that will be used to define the rule which is defined at runtime.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


Steps to reproduce the problem

  1. Create a Windows Workflow Foundation project in Microsoft Visual Studio 2005.

Note Visual Studio 2005 Extensions for Windows Workflow Foundation must be installed on the computer.

  1. Add two activities in the project, and then drop two IfElse controls in the two activities.
  2. Set the rule of one IfElse branch in the code.
  3. Set the rule of another IfElse branch in the .rules file by using the Rule Set Editor dialog box.
  4. Compile the project.

You may receive the compilation error that is described in the "Symptoms" section.

Keywords: kbtshoot kbprb KB926504