Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何创建自定义设置msi包/wix工具集/自定义操作_C#_Installation_Wix - Fatal编程技术网

C# 如何创建自定义设置msi包/wix工具集/自定义操作

C# 如何创建自定义设置msi包/wix工具集/自定义操作,c#,installation,wix,C#,Installation,Wix,我在编码和为客户开发解决方案方面是新手。我需要在VS中创建一个c#-winform应用程序,它能够生成msi工具集。但应用程序不是问题所在 我想创建一个预定义的“default”product.wxs文件,该文件将通过cmd从candle+light.exe构建到msi包中 *.wxs应该能够:创建文件路径、复制我定义的文件(1x.msi、1x.config、1x.cmd)以及在安装后-在管理上下文中执行batch.cmd 详细内容: 1.)我想将现有msi文件复制到定义的文件路径 2.)在管理

我在编码和为客户开发解决方案方面是新手。我需要在VS中创建一个c#-winform应用程序,它能够生成msi工具集。但应用程序不是问题所在

我想创建一个预定义的“default”product.wxs文件,该文件将通过cmd从candle+light.exe构建到msi包中

*.wxs应该能够:创建文件路径、复制我定义的文件(1x.msi、1x.config、1x.cmd)以及在安装后-在管理上下文中执行batch.cmd

详细内容:

1.)我想将现有msi文件复制到定义的文件路径
2.)在管理上下文中运行批处理文件:

  • msiexec/i file.msi/qn
  • 删除安装期间创建的配置文件
  • 将复制的配置文件移动到安装路径
在我的wxs中,我试图执行一个install.exe,它只是调用批处理文件,但它对我不起作用。当我尝试使用rightclick执行时-以管理员身份运行-它可以工作

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Version="5.0" Language="1033" Name="InstallConfigPackage" Manufacturer="ABC">
        <Package InstallerVersion="300" Compressed="yes" />
        <Media Id="1" Cabinet="MyApplication.cab" EmbedCab="yes" />
        <Property Id='REINSTALLMODE' Value='amus'/>

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFiles64Folder">
                <Directory Id="MyApplicationFolder" Name="Manufacturer">
                    <Directory Id="MyFirstSubDir" Name="MyApplication">
                        <Directory Id="MySecondSubDir" Name="Version">
                            <Directory Id="MyThirdSubDir" Name="Files"/>
                        </Directory>
                    </Directory>
                </Directory>
            </Directory>
        </Directory>

        <DirectoryRef Id="MyThirdSubDir">
            <Component Id="app.config" Guid="*" Win64="yes">
                <File Id="app.config" Source="MySourceFiles\app.config" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="application.msi" Guid="*" Win64="yes">
                <File Id="application.msi" Source="MySourceFiles\application.msi" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="batch.cmd" Guid="*" Win64="yes">
                <File Id="batch.cmd" Source="MySourceFiles\batch.cmd" KeyPath="yes" Checksum="yes"/>
            </Component>
        </DirectoryRef>

        <Feature Id="CONFIG" Title="CONFIG" Level="1">
            <ComponentRef Id="app.config" />
        </Feature>
        <Feature Id="MSI" Title="MSI" Level="1">
            <ComponentRef Id="application.msi" />
        </Feature>
        <Feature Id="BATCH" Title="BATCH" Level="1">
            <ComponentRef Id="BATCH.cmd" />
        </Feature>

        <Binary Id="install.exe" SourceFile="MySourceFiles\install.exe"/>
        <CustomAction Id="install.exe" BinaryKey="install.exe" ExeCommand="/s" Impersonate="no" Execute="deferred" Return="check" />

        <InstallExecuteSequence>
            <Custom Action="install.exe" After="InstallFiles">Not Installed</Custom>
        </InstallExecuteSequence>

    </Product>
</Wix>

未安装

MSI有一个互斥锁,可防止一个MSI安装另一个。您必须使用一个互斥锁来安装多个软件包。