问题
I'm not very impressed with Visual Studio Express 2013, which is the free version of Visual Studio. I would greatly prefer to just compile my C# program form the command line. I've located the compiler csc.exe and I located the DLL files for .NET, but how can I compile a XAML file?
回答1:
You want to use MSBuild (MSDN). This is the standard way to compile .NET projects from command line. This is also the compiler that Visual Studio uses internally. You have to have a .csproj/.sln file for it to work, but it will be the fastest and most effective way to get to where it sounds like you want to be.
回答2:
You're looking for MSBuild. Visual Studio projects are XML scripts for MSBuild. To build a project or solution, you can use the following commands:
MSBuild MyApp.sln
MSBuild MyApp.csproj
Building XAML files is far from trivial and C# compiler isn't enough for this. The most recent MSBuild targets for XAML is in the C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Xaml.targets
file. But doing all this manually isn't the best idea, you'll just overcomplicate things even if you manage to do everything without MSBuild.
来源:https://stackoverflow.com/questions/22316544/windows-how-to-compile-wpf-xaml-based-program-from-command-line