当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to compile a code-behind file with XAML from the command line?

问题描述:

I have this XAML file (MainWindow.xaml):

<Window xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

<Button>

Click!

</Button>

</Window>

I have this MainWindow.xaml.cs file (code-behind for the above xaml):

class MainWindow : Window{

}

I have this .cs file (Driver.cs) that launches the application:

using System;

using System.Windows;

class EntryPoint{

[STAThread]

public static void Main(){

Application app = new Application();

app.StartupUri = new Uri(@"path\to\MainWindow.xaml");

app.Run();

}

}

This is my command:

csc /target:exe /r:<dll list> Driver.cs

What i want to do is 'connect' my xaml and code-behind file from the command-line. I don't understand how to specify the value for x:Class in the xaml and compile the three files together. Right now, the above command works fine but without the code-behind. How do i plumb? I am trying to understand how to create a basic WPF app without the help of VS.

分享给朋友:
您可能感兴趣的文章:
随机阅读: