I need to compile simple WPF application, which I have written using Visual Studio, with the command line C# compiler (i.e csc.exe
).
Problem is the error CS0103
— the compiler says that there is no InitializeComponent()
method in my program. But that's wrong, because I add System.Xaml.dll. Does anybody know how to solve this?
Building with MSBuild will be the easier path than with csc.exe. Get the path to the correct MSBuild (Path to MSBuild), since you can have multiple MSBuild versions on your computer, most of the time one per Visual Studio installation.
Then, simply build your project file:
and the output will be in the bin/Release folder.
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
If you don't mind the dev environment opening a sure fire way to compile is to use:
C:> devenv HacksWinSample.sln /build release
see http://archive.oreilly.com/pub/h/5186
Using this approach you can easily see what any problem is and debug it.