@Day22 | C# WixToolset + WPF 帅到不行的安装包 [建立基本的WPF框架]

终於

熬了那麽久 我们终於可以来首刻了….
我们先创出一个是至少能加入的WPF视窗的类别库
可以直接选-自订控制项程序库

建立好专案後,我们依序建立Models Views ViewModels 的资料夹
接下来九成可以参考stoneniqiu写的文章,
毕竟当初我也是跟着走就建立起来了!
↓↓↓↓↓↓↓↓ 请连过去 ↓↓↓↓↓↓↓↓↓↓
https://www.cnblogs.com/stoneniqiu/p/4399343.html

程序码的部分就大同小异了,尊重原创我就不复制贴上程序码了,
请连过去试过後再回来看接下来我改不一样的部分 。


而我没使用Prism,下面几点是不同的地方

1.BootstrapperCore.config

这个assemblyName他命名这个专案时使用 CustomBA ,我们必须改成我们自己的名称

<host assemblyName="DemoUse.WPFView">
    <supportedFramework version="v4\Full" />
    <supportedFramework version="v4\Client" />
</host>

2.InstallViewModel

参考到不能再参考後,还会有两个错误

  • CustomBootstrapperApplication.Plan 改成
  CustomBootstrapperApplication.Model.Engine.Plan(LaunchAction.Uninstall);
  • HResult.Succeeded要安装套件Microsoft.VisualStudio.Services.Client

3.同样在InstallViewModel

搜寻DIAView取代成DemoInstaller,如果你在这边有改名称就用你自己的

4.同样在InstallViewModel

InstallCommand 先一律改成为true

    InstallCommand = new RelayCommand(param => model.PlanAction(LaunchAction.Install), param => true);

5.BootstrapperCore.config

复制到输出目录=> 一律复制,不然建置会出现错误

6.Bundle.wxs

在引入完其他DLL後,要加入这个没讲到的,但有偷偷加的不然会出现错误

<WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>
 <WixVariable Id="WixMbaPrereqPackageId" Value=""/>

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
  xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
  xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="DemoUse.Bootstrapper" Version="1.0.0.0" Manufacturer="Demo" UpgradeCode="37bbfd2f-0889-4b32-90db-eea5cbea61ce" DisableModify="yes" DisableRemove="yes">
 <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
   <Payload SourceFile="$(var.DemoUse.WPFView.TargetDir)DemoUse.WPFView.dll" />
   <Payload SourceFile="$(var.DemoUse.WPFView.TargetDir)BootstrapperCore.config" />
 </BootstrapperApplicationRef>
 <WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>
 <WixVariable Id="WixMbaPrereqPackageId" Value=""/>
 <Chain>
   <PackageGroupRef Id="AspNetCoreRuntime31Web"/>
   <MsiPackage Id="DemoInstaller" SourceFile="$(var.DemoUse.Installer.TargetDir)DemoUse.Installer.msi"
           Compressed="yes" DisplayInternalUI="yes" Visible="yes" />
 </Chain>

7.同样在Bundle.wxs

将原本的安装包给影藏掉,DisplayInternalUI 改为no

最後应该都没问题後执行,
完成….



  • 後记

哈!就算我已经写过了,
真的还是得花很久时间去找相关问题….
但这还只是开始而已 哈哈!

Day22程序码
https://github.com/Aslan7826/defaultMVC/commits/Day22


<<:  07. DB x Factory x Test

>>:  Day7 NiFi - Connection

[经典回顾]过旧的作业系统事故纪录

2018年司法院新闻稿 有关司法院及所属网路遭网军攻击事宜,本院说明如下: 一、事实经过:107年3...

伸缩自如的Flask [day 7] Post data with Form tag

可以先把下面的范例载下来,并执行app.py: https://github.com/wilsons...

Day21 切版笔记- 图文满版区块

铁人赛的前20天,把常常混淆的那些观念重新理解过一遍之後,後面的10天打算来练习切版,希望透过实际练...

第二十七日-MYSQL的「如果」:IF、CASE基本用法

IF、CASE翻成中文就是「如果」,根据条件来决定要执行的事情, 在各个程序语法理面都会有类似的语法...

Day 28. Hachicorp Consul: Server configuration for production

Hachicorp Consul: Server configuration for product...