0

I am currently working with a bunch of c sharp scripts and I want to implement this such that each script will be quite unique for a certain task . Which is why I want to #load certain script when a certain condition is fulfilled. But seems like by trying tom do so is not allowed in scriptcs

ERROR: Error executing script 'app.csx' [InvalidDirectiveUseException] Encountered directive '#load' after the start of code. Please move this directive to the beginning of the file.

What I would like to know is whether there is any alternative method to implement a similar functionality in csx

Below is a code from what I hope to achieve

string value ="1";
if(value.Equals("1"))
{
#load install1.csx
}

else if(value.Equals("2"))
{
#load install2.csx
}

else
{
#load install3.csx
}
Devss
  • 67
  • 7

1 Answers1

2

#load can only be placed at the top (before first using statement or code line) of your CSX file. if you place #load inline out script pre-processor will simply exclude it. This is in-line with C# REPL/C# Interactive Window behavior.

vika4321
  • 61
  • 1