Building a WPF Application using Command Line Compilation A WPF application written entirely in code (ie no markup) can be built by
using a command line compiler. For example, consider a WPF standalone
application, written in C#, with the following source code files:
- An application definition file (app.cs).
- List item
A window (mainwindow.cs).
This application can be built using the C# command line compiler,
csc.exe, using the following command:
csc.exe
/out:WPFApplication.exe
/target:winexe
app.cs mainwindow.cs
/reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\presentationframework.dll"
/reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\windowsbase.dll"
/reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\presentationcore.dll"
In this example:
- The /out parameter is used to specify the name of compiled executable application (WPFApplication.exe).
- The /target parameter is used to specify the type of application that is compiled (a Microsoft Windows executable).
- The C# source code files are specified (app.cs and mainwindow.cs)
- The /reference parameter is used to identify the .NET Framework 3.0 assemblies with types that are used from the source code.
While this application is composed of two source code files, command
line compilation can be used to build applications with more
complexity (see Building from the Command Line (CSharp)). However,
command line compilation does not support the compilation of WPF
applications that include Extensible Application Markup Language
(XAML) markup source code files. Furthermore, command-line compilation
is not robust enough to support the full range of build requirements
that are required by typical WPF applications, including configuration
management and ClickOnce application and deployment manifest
generation. To support the more complex build requirements of WPF
applications, WPF integrates with and extends the MSBuild.
Please note, that MSBuild might be better option for building more complex solutions, and it is supported out of box by most of the continuous integration solutions.
More info here:
https://msdn.microsoft.com/en-us/library/aa970678(v=vs.85).aspx