faqts : Computers : Programming : Languages : Tse : Language : Computer : C#

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

TSE: Language: Computer: Compile: C#: How to run C# from TSE?

Sep 11th, 2003 07:58
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 11 September 2003 - 04:21 pm ------------------

TSE: Language: Computer: Compile: C#: How to run C# from TSE?

The idea is that you use one keyboard action (e.g. <CTRL><F9>, or
<ESC>->'Macro'->'Compile') to compile or run any language, which you 
develop via TSE.

At least that is the way it works on my computer.

Not much thinking when having to compile, always the same action.

---

What you do is you create a batch file for each language involved,
then change the compiler settings in TSE.

---

This ideas can be adapted to an arbitrary language, be it C++, C#, 
PERL,
PHP, Python, ASP, Java, XML, ...

---

1. create a batchfile 'comcshar.bat', containing this text
(adapt it to your system) and store this batchfile in your TSE 
directory
(e.g. save to c:\mytsedirectory\comcshar.bat)

  "c:\WINDOWS\Microsoft.NET\Framework\v1.0.2914\csc.exe" %3

  @IF errorlevel=1 GOTO fail
  CLS
  %1.exe
  @GOTO end

  :fail
  @ECHO.
  @ECHO.
  @ECHO.
  @ECHO There where errors found while compiling your program.
  @ECHO.
  @ECHO Could not compile to .exe...
  @ECHO.
  @ECHO.

  :end
  @PAUSE
  @EXIT

2. Adapt the compiler information

   (in TSE, after loading any file, press <SHIFT><F9>
   then 'D' for debug compiler setup
   then <ALT><C> to copy one of the compiler settings present
   then change the fields:

   'Extension' to: .cs
   'Description' to: C#
   'Command' to: c:\mytsedirectory\comcshar.bat &name& &ext& &fn& > 
&output&

   make sure this information is permanently stored in the compiler
   information (via <ENTER>, then <ESCAPE>)

3. If you now load a .cs file, fill in some program code for C#,
   for example type or copy this text in a file 'HelloWorld.cs'

class HelloWorld {
 static public void Main() {
  System.Console.WriteLine( "Hello World" );
 }
}

   save that text e.g. in your TSE directory,
   then press <CTRL><F9> or <ESCAPE><M><C> to compile, this will run 
that
   batch file, which first copies your file to a .htm file,
   then starts your browser with that .htm file.

---

Note:

you should have the free Microsoft .net SDK installed, or Microsoft 
Visual
Studio, so that csc.exe can be found on your computer.

---

[Internet: see also: 
http://www.faqts.com/knowledge_base/view.phtml/aid/24297]

----------------------------------------------------------------------