Using CSC Compiler to Create WPF Programs
Create a native Windows program without installing any additional software
Steps
Create a folder, this folder is your workspace for your project as shown in Figure 1
Create a batch file in as shows in Figure 2
Save that batch file in your workspace folder
OPTIONAL: save the dll library files in your workspace to make effort easier
Figure 1: Workplace folder
cd /d %~dp0
@echo on
if not exist Program.exe (echo Compiling Program...) else (DEL Program.exe)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:PresentationFramework.dll,WindowsBase.dll,PresentationCore.dll,System.Xaml.dll /out:Program.exe Program.cs
ECHO Generating File...
if not exist Program.exe (echo ERROR: PROGRAM DOES NOT EXIST OR DID NOT COMPILE) else (start "" Program.exe)
PAUSEFigure 2: The batch file
Functional Description of the Batch File
If Windows does not see an executable file named, “Program.exe“, it will create the file and name it “Program.exe“
Find the csc compiler (this is where the compiler is usually located), and run it with the following libraries listed after the “/r:“, (the libraries are found different directories mentioned later)
Compile “Program.exe“ using the Program.c file (This is what is after the “/out:")
Tell the user on the terminal its progress with “ECHO“
Make sure that “Program.exe“ exists, then run it
Location of the dll File Libraries
C:/Windows/Microsoft.NET/Framework/v4.0.30319/WPF
System.Xaml.dll can be found here:
C:/Windows/Microsoft.NET/Framework/v4.0.30319
Video Demo
Why Compiling in this Way is Still Useful
Due to data rights, your IT department may restrict what software may be installed on your computer. However, the .NET Framework usually comes installed with every Windows PC. This means that you can create C#, Windows Presentation Framework (WPF) programs on any machine you like without asking for special permission.



