Wix 安装程序将 Dotnet Framework 4.81 与之前构建的 msi 捆绑在一起

问题描述 投票:0回答:2

我尝试构建一个仅捆绑 Dotnet Framework 4.81 的安装程序和一个简单的测试应用程序。

我不断收到错误消息“wix.exe:错误 WIX0001:System.ArgumentNullException:值不能为空。”

我创建了一个Bundle(Wix v4)项目,下面是Bundle.wxs文件。

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
  <Bundle Name="TestBundleInstaller" Manufacturer="TODO Manufacturer" Version="1.0.0.0" UpgradeCode="d090a306-15fc-4e04-985e-83cbb3a2cf5f">
    <BootstrapperApplication>
      <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" />
    </BootstrapperApplication>

    <Chain>
        <!-- TODO: Define the list of chained packages. -->
        <ExePackage DetectCondition="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED" InstallArguments="/q" UninstallArguments="/q">
            <Payload SourceFile="DirectoryTo\NDP481-x86-x64-AllOS-ENU.exe"/>
        </ExePackage>
        <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
        <MsiPackage SourceFile="DirectoryTo\TestSetup.msi" />
    </Chain>

  </Bundle>
</Wix>

下面是 TestBundleInstaller.wixproj 文件。

<Project Sdk="WixToolset.Sdk/4.0.0">
  <PropertyGroup>
    <OutputType>Bundle</OutputType>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <OutputPath>bin\x64\Debug</OutputPath>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <None Include="NDP481-x86-x64-AllOS-ENU.exe" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="WixToolset.Bal.wixext" Version="4.0.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\TestSetup\TestSetup.wixproj" />
  </ItemGroup>
</Project>

阅读了很多Wix教程和文档,我仍然不明白我遇到的错误。非常感谢任何帮助。

构建输出:

构建开始...

1>------ 跳过构建:项目:测试,配置:调试 x64 ------

1>未选择为此解决方案配置构建项目

2>------ 跳过构建:项目:TestSetup,配置:调试 x64 ------

2>未选择为此解决方案配置构建项目

3>------ 构建开始:项目:TestBundleInstaller,配置:调试 x64 ------

恢复C:\Users\JJacobs\source epos\TestBundleInstaller\TestBundleInstaller.wixproj(2 毫秒内)。

3>wix.exe:错误 WIX0001:System.ArgumentNullException:值不能为空。

3>完成构建项目“TestBundleInstaller.wixproj”——失败。

========== 构建:0 成功,1 失败,0 最新,2 跳过 ==========

.net visual-studio wix windows-installer
2个回答
0
投票

ArgumentNullException
是 WiX 中的一个错误。请提出问题:https://wixtoolset.org/docs/gethelp/#bugs


0
投票
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace TestCShorpInstaller
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.Process installerProcess = new Process();
            System.Diagnostics.ProcessStartInfo processInfo = new ProcessStartInfo();

            RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full");
            if (key != null)
            {
                Object o = key.GetValue("Release");
                Int32 releaseVal = (Int32)o;
                if( releaseVal < 533320) {
                    processInfo.FileName = ".\\NDP481-x86-x64-AllOS-ENU.exe";
                    installerProcess.StartInfo = processInfo;   
                    installerProcess.Start();
                    installerProcess.WaitForExit();
                }

            }

            installerProcess = new Process();
            processInfo = new ProcessStartInfo();
            processInfo.Arguments = @"/i  .\TestSetup.msi  /q";
            processInfo.FileName = "msiexec";
            installerProcess.StartInfo = processInfo;
            installerProcess.Start();
            installerProcess.WaitForExit();
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.