April 29, 2008

Building WPF application through console

Filed under: WPF — Tags: , , — @ 2:52 am

I build a simple WPF application using VS2008 and everything was ok. I needed to do little bit more outside the application (like adding a dynamic resource file to the WPF) so I decided to compile the application outside the IDE. I tried to compile it with the information provided in the MSDN page and it proved little difficult because of all the dlls I need to include during compile. So if you are like me trying to build WPF application through command line, the shortcut is, first build it through IDE. After the build is successful look at the output tab (at the bottom on the IDE), the first command is command line compiler call to build the application. So just cut and past it from there to a notepad or other editor where you would like to investigate what are all the required components for building the application.

Couple of things you have to remember, if you are going to compile the application from a location other than the project location, make sure all the source code files are converted to absolute path instead of relative path as in the IDE.

Once you make the change, now you can put it in a notepad and create a batch program and try running the batch program whola! you got yourself the exe.

Here is an excellent documentation on how to build wpf application from MS.

Powered by WordPress