How to create a Wix Exepackage that only has a download link

8.1k views Asked by At

I am trying to create an ExePackage [using the DownloadUrl property] in my bundle that downloads Sql Express 2014 and installs it using the following code

<ExePackage Id="Sql2014Express"
    DisplayName="SQL Server 2014 Express"
    Cache="no"
    Compressed="no"
    PerMachine="yes"
    Permanent="no"
    Vital="yes"
    Name="SQLEXPRWT_x64_ENU.exe"
    DownloadUrl="http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAndTools%2064BIT/SQLEXPRWT_x64_ENU.exe"
    InstallCommand="/ACTION=Install /INSTANCENAME=$(var.InstanceName) /FEATURES=SQL /SECURITYMODE=SQL [SqlVariable] /TCPENABLED=1 /SQLSVCACCOUNT=&quot;NT AUTHORITY\NETWORK SERVICE&quot; /SQLSVCSTARTUPTYPE=Auto /SQLSYSADMINACCOUNTS=BUILTIN\Administrators /ADDCURRENTUSERASSQLADMIN=FALSE /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms"
    UninstallCommand="/Action=Uninstall /INSTANCENAME=$(var.InstanceName) /FEATURES=SQL /Q /HIDECONSOLE"
    DetectCondition="SqlInstanceFound"
    InstallCondition="$(var.ServerInstall)">
    <ExitCode Value ="3010" Behavior="forceReboot" />
  </ExePackage>

When I try and build the installer package I receive the following error....

Error   2   The system cannot find the file 'SourceDir\SQLEXPRWT_x64_ENU.exe'.  

I can set the SourceFile property to a local file and include that in my install but I would prefer to not have to move around an 800mb+ file with my installer.

2

There are 2 answers

4
Ryan J On BEST ANSWER

If you set up your bundle to Compressed=no it will not include the source file in your final bundle. The reason you're getting the "File not found" is because when the installer is built, it requires a local version of the package EXE file in order to get information from it. If you want to build a project which only has a download URL, you need to specify a RemotePayload element, and supply some more defining information about the remote package.

This will allow you to build the install package without having to have the source file on the machine, but you'll need to be sure your payload is accurately described or your install will fail.

On your ExePackage element, be sure you include the Name attribute, which is one of the required attributes next to SourceFile, but SourceFile is not allowed with RemotePayload. Your example includes it, so you should be OK there.

Include the <RemotePayload> element as a child of ExePackage like so:

<RemotePayload Description="MyRemoteApp" ProductName="MyProductName" Size="size-in-bytes" Version="1.1.1.1" Hash="SHA-1-checksum-here"/>

Where all of the information required are attributes of your specific package. If this is not an option, you will need to make sure the source file is available locally at build-time, but ensure that it is not compressed, so the user can install and the payload will be downloaded from your URL.

See the RemotePayload reference for more info.

0
Anne Gunn On

RyanJ's answer is great. It got me off square one after failing to find the right magic combo on my own. But it still took me some trial and error to create a bundle wxs file that actually worked. So, for the record, if you create a new bundle project in Visual Studio and then replace the bundle.wxs contents with:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle 
Name="BundleExperiment" 
Version="1.0.0.0" 
Manufacturer="Windows User" 
UpgradeCode="UNIQUE-GUID-GOES-HERE-YADADADA"
Compressed="no">

    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

<Chain>
  <ExePackage Id="DymoLabelSoftware"
       SourceFile="DLS8Setup.8.5.1.exe"
       DownloadUrl="http://download.dymo.com/dymo/Software/Win/DLS8Setup.8.5.1.exe" />
</Chain>
</Bundle>

you can see how this works and then modify it to work with whatever exe package you are trying to bundle.*

It was really counterintuitive to me that you needed to specify values for SourceFile AND DownloadUrl AND still have a copy of the downloaded file in your project directory. Actually, it was more than counterintuitive. I was certain that NOT having the downloaded file in my project directory was how I told Burn to omit the file from the package. But here's how I now understand it:

  • 'Compressed="no"' -- tells Burn to not embed the exe in the bundled installer it is building
  • 'SourceFile="DLS8Setup.8.5.1.exe"' -- tells Burn to go out to the project directory and use the downloaded, local copy of the target package to generate all of the info you would otherwise have to figure out and put in your RemotePayload record
  • 'DownloadUrl=...' -- is the one part that seemed obvious to me from the start

*"With whatever exe you are trying to bundle" disclaimer: I originally tried, really hard, to use a Git Windows installer package for this example. And, using exactly the same syntax (and correct names and paths, really!), the bundled install always failed with an access error and a message something like 'failed to acquire the payload' in the log file. The only thing odd about the Git download that I noticed was that it wasn't really coming from the URL I was using but was redirecting the download to come from somewhere in the Amazon S3 cloud. My guess is that Burn / WIX / Windows Installer may object to that sleight of hand -- and kind of reasonably so. Hence, depending on what installer you want to bundle, you might have to give it a fixed URL under your own control to make it work with this feature.