How to: Create an Executable File to Run a Management Agent
You can create a C# file, compile it into an executable file, and then use this file to run a management agent run profile. Although this is more complicated than creating a Visual Basic script to run a management agent run profile, the advantage is that the compiled file can run as a stand-alone file that does not require a script engine.
You can create a C# file using Synchronization Service Manager. You can then compile the file into an executable file by using the command-line compiler that is supplied with the Microsoft .NET Framework. To use the compiler, you must add the compiler location to the path variable of your computer.
To add the compiler path to your system
Find the location of the .NET Framework compiler, csc.exe. Note the location of this file.
Click Start, right-click My Computer, and then click Properties.
On the Advanced tab of System Properties, click Environment Variables.
In the System Properties list box of the Environment Variables dialog box, click Path, and then click Edit.
In the Edit System Variable dialog box, go to the end of the text in the Variable value text box, and type a semi-colon (;) followed by the location of the .NET Framework compiler. Click OK to close the dialog boxes.
After you add the compiler path to your computer, you can use Synchronization Service Manager to create a source file for a run profile.
To create the source file for a run profile
In Synchronization Service Manager, on the Tools menu, click Management Agents.
In Management Agents, click a management agent.
On the Actions menu, click Configure Run Profiles.
In the Configure Run Profiles for Management Agent dialog box, in Management agent run profiles, click the run profile that you want to compile into an executable file, and then click Script.
In the Save as dialog box, type a name and location for the script.
In the Save as type drop-down list, click C# Files.
Note
The compiler can create an executable file only from a C# file. The compiler cannot create an executable file from a Visual Basic script (.vbs) file.
After you create the C# source file for a run profile, you can use the compiler to compile the source file into an executable file that you can run as a stand-alone file.
To create an executable file from the source file
Open a Command Prompt window, and browse to the location of your source file.
At the command prompt, type
csc <source file name>
, and then press ENTER.
The compiler creates an executable file of the same name as your source file. For more information about the compiler, see Building From the Command Line.
See Also
Concepts
Creating Scripts
How to: Create Scripts to Run Management Agents
How to: Create Management Agents