Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

c# - WiX - Install Prerequisites and 3rd party applications

I have a wix Windows Installer for my C# application. Things are working, I am able to install and uninstall the application. But I have few Prerequisites and other 3rd party applications that I want to install with my application.

Prerequisites:

  1. Microsoft .NET Framework 4 (x86 and x64) - dotNetFx40_Full_x86_x64.exe
  2. SQL Server 2008 Express
    1. SQLEXPR_x64_ENU.EXE
    2. SQLEXPR32_x86_ENU.EXE
  3. SQL Server Compact 3.5 SP2
    1. SSCERuntime-ENU.msi
    2. SSCERuntime-ENU-x64.msi

3rd Party Application:

  1. TeamViewer - TeamViewer_Setup.exe

So of-course I am not looking for complete guidelines for all the Prerequisites and 3rd party applications. I just need you folks help on figuring out on how exactly I can embed these exe and msi setups to be a part of my wix installation.

Also, some are for x64 and some are for x86, so it should be capable enough to handle the OS version and architecture. How will this be accomplished with wix.

I have been searching on internet for a while now and nothing concrete seems to be working for me.

I need to make sure that if these applications are not installed then the software should also not install. Along with that if any of the prerequisite or 3rd party application is already installed then it should not install again.

I guess this can be done using some wix tools but I am not able to get any concrete instructions on howto.

EDIT 1

Ok I have got the Microsoft .NET Framework 4 (x86 and x64) installed, and the problem which I am facing now is I am unable to install SQL Server Compact 3.5 SP2. I am doing things one by one to make things more clear to me. Here under I am sharing my code so that you people can review:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="Billy"
        UpgradeCode="PUT-GUID-HERE">
  <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
  <Chain>

    <PackageGroupRef Id="Netfx4Full"/>
    <PackageGroupRef Id="SQLExpressCE"/>

    <!-- Install Application -->
    <MsiPackage Id="MyApplication" SourceFile="$(var.Installer.TargetPath)"/>

  </Chain>
</Bundle>

<Fragment>
  <!-- Check for .NET 4.0 -->
  <util:RegistrySearch Root="HKLM"
                       Key="SOFTWAREMicrosoftNet Framework SetupNDPv4Full"
                       Value="Version"
                       Variable="Netfx4FullVersion" />
  <util:RegistrySearch Root="HKLM"
                       Key="SOFTWAREMicrosoftNet Framework SetupNDPv4Full"
                       Value="Version"
                       Variable="Netfx4x64FullVersion"
                       Win64="yes" />

  <!-- Install .NEt 4.0 -->
  <PackageGroup Id="Netfx4Full">
    <ExePackage Id="Netfx4Full"
                DisplayName="Microsoft .NET Framework 4.0"
                Compressed="no"
                Cache="yes"
                PerMachine="yes"
                Permanent="yes"
                Protocol="netfx4"
                Vital="yes"
                SourceFile=".prerequisitesdotNetFx40_Full_x86_x64.exe"
                InstallCommand="/passive /norestart"
                DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
  </PackageGroup>

  <!-- Install SQL Server CE -->
  <PackageGroup Id="SQLExpressCE">
    <MsiPackage
              Cache="no"
              Compressed="no"
              ForcePerMachine="yes"
              Permanent="yes"
              Vital="yes"
              SourceFile=".prerequisitesSSCERuntime-ENU.msi"
              InstallCondition="NOT VersionNT64 AND SqlInstance AND SqlServerInstalled AND SQLServer2008R2Installed" />
    <MsiPackage
              Cache="no"
              Compressed="no"
              ForcePerMachine="yes"
              Permanent="yes"
              Vital="yes"
              SourceFile=".prerequisitesSSCERuntime-ENU-x64.msi"
              InstallCondition="VersionNT64 AND NOT SqlInstance AND SqlServerInstalled AND SQLServer2008R2Installed" />
  </PackageGroup>

</Fragment>
</Wix>

NOTE: The above code installs .NET Framework, its not installing SQL Server Compact 3.5 SP2


EDIT -2

After Referring Tom Blodget answer I have reached to this far, however I am unable to understand how to give the Install Command for my SQL Exe package and same for my MSI package. I have also gone through this answer https://stackoverflow.com/a/19010097/1182021 of Mr. Neil Sleightholm but this one is for SQL 2012, how can I do this same thing with SQL 2008 Server and CE (The conditions and steps)

<PackageGroup Id="SQLExpressCE">
  <ExePackage
            Cache="no"
            Compressed="no"
            Permanent="no"
            Vital="yes"
            InstallCommand="/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT=&quot;NT AUTHORITYNetwork Service&quot; /SQLSYSADMINACCOUNTS=&quot;BUILTINADMINISTRATORS&quot; /AGTSVCACCOUNT=&quot;NT AUTHORITYNetwork Service&quot; /SECURITYMODE=SQL /SAPWD=&quot;wegamed&quot;"
            SourceFile=".prerequisitesSQLEXPR32_x86_ENU.EXE"
            DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
            InstallCondition="NOT SQLServer2008R2Installed AND NOT SQLServerInstalled" />
  <ExePackage DetectCondition="VersionNT64"
            Cache="no"
            Compressed="no"
            Permanent="no"
            Vital="yes"
            InstallCommand="/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT=&quot;NT AUTHORITYNetwork Service&quot; /SQLSYSADMINACCOUNTS=&quot;BUILTINADMINISTRATORS&quot; /AGTSVCACCOUNT=&quot;NT AUTHORITYNetwork Service&quot; /SECURITYMODE=SQL /SAPWD=&quot;wegamed&quot;"
            SourceFile=".prerequisitesSQLEXPR_x64_ENU.EXE"
            DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
            InstallCondition="NOT SQLServer2008R2Installed AND NOT SQLServerInstalled" />
</PackageGroup>

But Setup is unable to complete. I guess it is because of the install commands as it works till accept licence agreement.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

See the WiX 3.7 docs on "Building Installation Package Bundles". If you are using MSBuild, SharpDevelop or Visual Studio (non-Express), you can use the WiX Bootstrapper project template. If you prefer to call the toolset command-line tools yourself, they are candle and light, just like for building MSI files.

See the WiX 3.7 docs on "How To: Install the .NET Framework Using Burn". Note: WiX offers two pre-defined packages for .NET 4.0, both download from Microsoft at install-time. One is the full package, the other is the downloader package that downloads just is needed on the user's system. If you'd rather not have your installer depend on Internet access, you can write your own package as you have to do with any arbitrary exe that you bundle. Obviously, the WiX source code can help with the .NET 4.0 packages as it has the detect condition, install command, and uninstall command that you'd need.

See the installation docs for each of the other packages to find out what you should put into their detect conditions, install commands, and uninstall commands. And, again, you'd have the choice of putting a download URL in each package or not.

SQL Server CE

<PackageGroup Id="SQLExpressCE">
    <!-- Per http://support.microsoft.com/kb/974247, on a 64-bit system both 32-bit and 64-bit packages must be installed and be the same version. -->
    <MsiPackage
          Visible="yes"
          Cache="no"
          Compressed="no"
          ForcePerMachine="yes"
          Permanent="yes"
          Vital="yes"
          SourceFile=".prerequisitesSSCERuntime-ENU.msi" />
    <MsiPackage
          Visible="yes"
          Cache="no"
          Compressed="no"
          ForcePerMachine="yes"
          Permanent="yes"
          Vital="yes"
          SourceFile=".prerequisitesSSCERuntime-ENU-x64.msi"
          InstallCondition="VersionNT64" />
</PackageGroup>

WiX Burn Troubleshooting

Burn creates a log file for itself as well as any MsiPackages it runs. Check your %TEMP% folder.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...