Wpf应用程序的发布和部署

本文详细介绍了WPF应用程序的发布和部署过程,包括关键步骤和注意事项,旨在帮助开发者理解如何将C#编写的WPF应用成功部署到目标环境中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

       我们知道wpf可以支持多种模式的应用程序发布,online,offline,xbap等,上次我去广州讲课,在讲得过程中,有个架构师就提到这个问题,因为我们在创建wpf程序的时候只能选择是application还是xbap模式,但不知道怎么才能把发布成为online或者offline模式,下面我就带领大家来看看是怎么发布的

点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>
8</Window>
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    /**//// <summary>
18    /// Interaction logic for Window1.xaml
19    /// </summary>

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菜单:

我们点击这个发布wpf应用程序后,出现下面的页面

这里面我们选择很多种路径,默认是http的网站,我这里改为本地的路径
我们next

这里包含很多种安装模式,我这里选择了以网站安装在线安装的模式点击next:

注意这里选择的是,应用程序是在offline和online情况下使用,也就是说如果选择了online那么在脱机的时候是没法使用的
下面就点击next,然后finish完成,我们查看刚才设置的d盘下,就会发现下面几个文件产生了

点击那个wpfapplication3.application测试下:


那个安装文件大家自己测试把。Ok wpf的部署就是这么简单,呵呵

转载于:https://www.cnblogs.com/liefeng123/archive/2008/04/07/1140758.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值