Secret Compilers Hidden Inside Windows Vista (and XP)
Visual Basic .NET (vbc.exe) and C# Compiler (csc.exe)
So, Windows contains 2 hidden compilers (and also more) of importance , they are the Visual Basic (vbc) and C# (csc) compilers, they are generally located in the following folder: C:\Windows\Microsoft.Net\Framework\ Find the corresponding folder for the latest version of .Net you have installed (v3.5 in my case) Once you have found the latest folder, which should contain vbc.exe and csc.exe copy its path and press Win+D (Show the Desktop) now right click and create a shortcut, paste the path you copied and add \vbc.exe for the Visual Basic Compiler and click next, add an appropriate name and click finish and do the same for the C# compiler by copying the path and adding \csc.exe and an appropriate name and again pressing finish. Now create a folder on the desktop called Sources (it can be called anything you like but this seems the most appropriate, and copy the following code sample into Notepad to first test the Visual Basic compiler: Imports System Save the file in notepad as hello.vb in the folder you created (Sources), now open the folder and drag the hello.vb file onto the shortcut you created, you should find a file called hello.exe in the folder you created, double click the file. If it works you should see something similar to this (Click image to see larger version): Congratulations, You just compiled your first VB app! ;-) Now, you can do the same for C# too, copy the following code into Notepad to test the C# Compiler: Class HelloWorld
Now you've tested both compilers, and they should both work correctly. So, to recap, you now know how to use an in-built Visual Basic .Net and C# compiler(s) inside Vista and XP. Below are some more code examples to try, mainly for VB.Net (vbc.exe): Display 10 instances of Hello World Imports System
Imports System Alternative version, this version requires you to compile from the command line, so open the Command Prompt (Hit the Win key and type cmd on Vista, or Start > All Programs > Accessories > Command Prompt on XP) and paste the following (change v3.5 for the version of .Net you have (see start of tutorial) also newwin.vb is the name of the file, change this for the filename you used to save the code: "C:\Windows\Microsoft.NET\Framework\v3.5\vbc.exe" newwin.vb /r:system.windows.forms.dll /r:system.dll /t:winexe /m:Form1 Ok, and so the code is below, save this file and replace the filename with newwin.vb to compile with the command above: Imports System
| Secret Compilers Hidden Inside Windows Vista (and XP) Links Visual Basic .Net Tutorials/Code Samples
C# Tutorials |
