An unhandled exception (''$FBVariables' is undefined') occured in FinalBuilder7.exe [1768]

I am getting an error when attempting to use $FBVariables.

Here is the error message.An unhandled exception (''$FBVariables' is undefined') occured in FinalBuilder7.exe [1768]

    Error Executing script : BeforeAction
    Microsoft JScript runtime error
    '$FBVariables' is undefined
    Line : 2
    Char : 3
    Error in BeforeScript : JavaScript, This Action did not execute.

I am using FinalBuilder 7.0.0.787.

This error occurs in the BeforeAction javascript of the Build VS.Net Solution (Using MSBuild) action.

Here is the javascript.  The error occurs on the yellow highlighted line below.function BeforeAction(Action, SkipAction) {
  switch($FBVariables.GetVariable("BuildTarget"))  {   case "2":        Action.OverrideTargetFramework = true;        Action.TargetFramework = TVSDotNetTargetFx.fx20;   break;   case "3":        Action.OverrideTargetFramework = true;        Action.TargetFramework = TVSDotNetTargetFx.fx30;   break;
   case "3.5":        Action.OverrideTargetFramework = true;        Action.TargetFramework = TVSDotNetTargetFx.fx35;   break;   case "4":        Action.OverrideTargetFramework = true;        Action.TargetFramework = TVSDotNetTargetFx.fx40;   break;  }

}

Drop the $ before FBVariables, it’s not needed for javascript.

Thanks, I will test it tomorrow (its 6:02 PM Eastern Time). I will respond with results tomorrow.

Now I get the same undefined error but now it is with this variable ‘TVSDotNetTargetFx’ same code block mentioned above.

Ah sorry, I didn’t look past the $FBVariables, try this :

switch(FBVariables.BuildTarget)
{
case “2”:
Action.OverrideSDKDefault = true;
Action.SDKVersion = “v2.0”;
break;
case “3”:
Action.OverrideSDKDefault = true;
Action.SDKVersion = “v3.0”;
break;
case “3.5”:
Action.OverrideSDKDefault = true;
Action.SDKVersion = “v3.5”;
break;

case “4”:
Action.OverrideSDKDefault = true;
Action.SDKVersion = “v4.0”;
break;
}

Thanks I will test this Monday morning US Eastern Time. What other posts, etc. Are good to look at to learn more about before action/ after action scripting?