WiX Wrapper Exe installer

WiX Wrapper Exe installer

使用WiX來封裝Exe成爲MSI文件

https://github.com/pennmanor/wix-wrapper/blob/master/owncloud.wxs


<?xml version='1.0'?>
<?define ProductVersion = "2.0.2"?> <!-- Match ownCloud Client version -->
<?define PrevProductVersion = "2.0.1"?> <!-- Match previous ownCloud Client version -->
<?define ExeSourceFile = "ownCloud-2.0.2.5569-setup.exe"?> <!-- Match new .exe -->
<?define ProductCode = "87CA6CC7-4F67-4663-974A-53BA46DA8E34"?> <!-- Regenerate for new upgrade -->
<?define ProductUpgradeCode = "5a4f6818-b8b2-4fda-b43c-9959a6d734ad"?> <!-- When upgrading, move previous ProductCode here -->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
        <Product Id='*'
                UpgradeCode="$(var.ProductUpgradeCode)"
                Name='ownCloud Sync Client'
                Language='1033'
                Version='$(var.ProductVersion)'
                Manufacturer='Penn Manor ownCloud'>
                <Package Id='$(var.ProductCode)'
                        Description='ownCloud Client $(var.ProductVersion)'
                        InstallerVersion='200'
                        Compressed='yes' />
                <Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />
                <Directory Id='TARGETDIR' Name='SourceDir'>
                        <Directory Id="TempFolder">
                                <Directory Id="INSTALLLOCATION" Name="~_tmpdir">
                                        <Component Id='MyComponent' DiskId='1' Guid='B3514243-DFB8-4BB1-8495-ED6153468361'>
                                                <File Id="File0" Name="$(var.ExeSourceFile)" Source="$(var.ExeSourceFile)" />
                                        </Component>
                                </Directory>
                        </Directory>
                </Directory>
                <Upgrade Id="$(var.ProductUpgradeCode)">
                        <UpgradeVersion Minimum="$(var.ProductVersion)"
                                IncludeMinimum="no"
                                OnlyDetect="yes"
                                Language="1033"
                                Property="NEWPRODUCTFOUND" />
                        <UpgradeVersion Minimum="$(var.PrevProductVersion)"
                                IncludeMinimum="yes"
                                Maximum="$(var.ProductVersion)"
                                IncludeMaximum="no"
                                Language="1033"
                                Property="UPGRADEFOUND" />
                </Upgrade>
                <Property Id="ARPSYSTEMCOMPONENT" Value="1" />
                <Feature Id='InstallFeature' Title='Install Feature' Level='1'>
                        <ComponentRef Id='MyComponent' />
                </Feature>


                <!-- Prevent downgrading -->
                <CustomAction Id="PreventDowngrading" Error="Newer version already installed." />


                <InstallUISequence>
                        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
                </InstallUISequence>


                <!-- Run Action -->
                <CustomAction Id="RunWrapExe"
                        Return="ignore"
                        Execute="deferred"
                        FileKey="File0"
                        ExeCommand="$(var.ExeSourceFile) /S"
                        HideTarget="no"
                        Impersonate="no" />
                <InstallExecuteSequence>
                        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
                        <Custom Action="RunWrapExe" After="InstallFiles">NOT REMOVE~="ALL"</Custom>
                        <RemoveExistingProducts After="InstallFinalize" />
                </InstallExecuteSequence>
        </Product>
</Wix>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章