How to create a Wix Exepackage that only has a download link
Asked Answered
T

2

10

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.

Tapster answered 10/11, 2014 at 18:29 Comment(1)
@Unsigned, not sure why you went in and pulled out the text part of my edit. This exchange has really useful info that I wasted a lot of cycles finding because the DownloadUrl term didn't appear in the text or title. I added it to a) maybe help searches and b) get the term into the first line of the question so someone clicking on the question would see that immediately.Myrna
B
18

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.

Brophy answered 10/11, 2014 at 18:58 Comment(4)
Do you know where I can easily find the size in bytes and md hash for various Microsoft installs?Tapster
The file size can be seen on the download page, but the easiest thing might be to just download it and use explorer to tell you. For the SHA-1/MD5, if the download page doesn't list it, you can compute it using any supported calculator utility on your system. This one should be able to do that for you.Brophy
For hash you can also use Get-FileHash PowerShell command (may not be available on older systems)Trisect
@Trisect Don't forget the -Algorithm SHA1 switch, otherwise you'll get the SHA256 hash by default, which won't work.Auvergne
M
5

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.

Myrna answered 15/6, 2015 at 22:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.