Thursday, January 10, 2008

Edit CSScript - Files with VisualStudio

With just two steps you can use VisualStudio to edit your CSScript -Files (*.csr).

Step 1


Inform the VS about the fileextension.

To do that please follow these steps:

  • start VS

  • open Tools/Options - Dialog

  • scroll down to "File Extensions"

  • enter "csr" to Extension Field

  • select C# as Editor and click on "Apply"




Step 2


Make your CSR - Code valid for intellisense and the c# compiler.
Sample:



#region HEADER
#if CSSRIPT
//place for the C#Script - Directives
loadASM "System.Windows.Forms.dll";
#else
//ignore this part
public class vsdummy
{
public void Main()
{
#endif
#endregion
//######################
//start of script - code
//######################

string msg = "Hello World";
for(int i=0;i<3;i++) msg+=String.Format("\n{0}...",i);

System.Windows.Forms.MessageBox.Show(msg, "CSSCript - Sample");

//####################
//end of script - code
//####################
#if !CSSRIPT
}
}
#endif


Have fun...

0 Comments: