点ok创建完后,为了清楚期间我们加上点测试代码
xaml
1<Window x:Class="WpfApplication3.Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="Window1" Height="300" Width="300">
5 <Grid>
6 <Button Content="Test" Width="50" Height="30" Click="Button_Click">Button>
7 Grid>
8Window>
1<Window x:Class="WpfApplication3.Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="Window1" Height="300" Width="300">
5 <Grid>
6 <Button Content="Test" Width="50" Height="30" Click="Button_Click">Button>
7 Grid>
8Window>
Code
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Data;
8using System.Windows.Documents;
9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14
15namespace WpfApplication3
16{
17 /**////
18 /// Interaction logic for Window1.xaml
19 ///
20 public partial class Window1 : Window
21 {
22 public Window1()
23 {
24 InitializeComponent();
25 }
26
27 private void Button_Click(object sender, RoutedEventArgs e)
28 {
29 MessageBox.Show("Hello");
30 }
31 }
32}
33
一般我们都是点击f5来运行,在我们部署的时候,我们按照下面的方式来编译,点击build菜单:
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Data;
8using System.Windows.Documents;
9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14
15namespace WpfApplication3
16{
17 /**////
18 /// Interaction logic for Window1.xaml
19 ///
20 public partial class Window1 : Window
21 {
22 public Window1()
23 {
24 InitializeComponent();
25 }
26
27 private void Button_Click(object sender, RoutedEventArgs e)
28 {
29 MessageBox.Show("Hello");
30 }
31 }
32}
33
我们点击这个发布wpf应用程序后,出现下面的页面
这里面我们选择很多种路径,默认是http的网站,我这里改为本地的路径
我们next
这里包含很多种安装模式,我这里选择了以网站安装在线安装的模式点击next:
注意这里选择的是,应用程序是在offline和online情况下使用,也就是说如果选择了online那么在脱机的时候是没法使用的
下面就点击next,然后finish完成,我们查看刚才设置的d盘下,就会发现下面几个文件产生了
点击那个wpfapplication3.application测试下:
那个安装文件大家自己测试把。Ok wpf的部署就是这么简单,呵呵