Burn update feature

Mar 7, 2013 at 2:14 PM
Does your custom ba support the Update feature in v3.7? if so do you have any examples?
Coordinator
Mar 7, 2013 at 4:03 PM
Yes it does. You need to add Update element to you bundle:
<Update Location="https://somewhere.co.uk/Upgrade.asp?version=1.2.3.4" />
The location pointed to by the URL should return the following XML if there is an upgrade available:
    <?xml version="1.0" encoding="utf-8"?>
     <Setup>
       <Upgrade Url="https://somewhere.co.uk/download/Setup.exe" Size="123" />
     </Setup>
The Upgrade/@Url should point to the actual URL of the update, Upgrade/@Size is optional but if supplied should be the size of the download.

If an upgrade is not available then return this:
    <?xml version="1.0" encoding="utf-8"?>
     <Setup>
       <Upgrade Url="" Size="" />
     </Setup>
The code will check for an update on startup and if there is a link will be displayed on the start page; you need control called UpgradeHyperlink on the start page, e.g.:
<Hypertext Name="UpgradeHyperlink" X="185" Y="-81" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#Version [WixBundleVersion] &lt;a href="#"&gt;upgrade available&lt;/a&gt;</Hypertext>
(See Bundle2Theme.xml for an example.)

Hope this helps.
Mar 7, 2013 at 5:16 PM
Do you have an example of the asp page code?
Coordinator
Mar 7, 2013 at 5:44 PM
Something like this:
<%
    response.ContentType = "text/xml"

    on error resume next

    currentVersion = request.querystring("version")
    url = ""                // Set URL
    size = ""               // Set size

    ' Write the response xml
    response.Write "<?xml version=""1.0"" encoding=""utf-8""?>"
    response.Write "<Setup>"
    response.Write "  <Upgrade Url=""" & url & """ Size=""" & size & """ />"
    response.Write "</Setup>"
%>
Mar 7, 2013 at 7:31 PM
I see that you pass the current version of the bundle to the ASP page by "version=1.2.3.4" how do you know that there is a newer version?

I think I am missing something.

Looking at your bundle2 example I see the update location is <Update Location="http://wixtoolset.org/releases/feed/v3.7"/>

that update url does not provide a version number.
Coordinator
Mar 7, 2013 at 8:20 PM
That is up to you really, the Wix feed doesn't supply this it is just a dummy url. In my scenario I look at the version of the new exe using fso but your solution may not match.
Mar 8, 2013 at 2:20 PM
Edited Mar 8, 2013 at 2:21 PM
bundle code: (Product version is 8.7.0.0
<?xml version="1.0" encoding="UTF-8"?>

<?include ..\..\files\ProductVersion.wxi ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Bundle Name="PixeLINK Software Development Kit" Version="$(var.ProductVersion)" Manufacturer="PixeLINK" UpgradeCode="{B5C6044D-BC0C-4c71-A231-FC61BC0D24BB}" Condition="VersionNT >= v5.01" HelpTelephone="613-247-1211" HelpUrl="http://pixelink.com/support.aspx" IconSourceFile="Resource\PixeLINK.ico" UpdateUrl="http://pixelink.com/support/download-search.aspx">
    <BootstrapperApplicationRef Id="WixExtendedBootstrapperApplication.HyperlinkLicense">
      <Payload SourceFile="Resource\PixeLINK_Software_License_Agreement_(EULA)v1.htm" />
      <Payload SourceFile="Resource\LogoSide.png" />
      <Payload SourceFile="Resource\LogoSmall.png" />

    </BootstrapperApplicationRef>
    <WixVariable Id="WixExtbaLicenseUrl" Value="PixeLINK_Software_License_Agreement_(EULA)v1.htm" />
    <WixVariable Id="WixExtbaThemeXml" Value="Resource\HyperlinkTheme2.xml" />
    <WixVariable Id="WixExtbaThemeWxl" Value="Resource\HyperlinkTheme2.wxl" />
    
    <Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]PixeLINK" />
    <Variable Name="MyCheckbox1" Type="numeric" Value="1"/>
    <Update Location="http://www.files.pixelink.com/uploads/Latest/index.asp?version=$(var.ProductVersion)"/>
    <Chain>
      <PackageGroupRef Id="Netfx35" />
      <RollbackBoundary />

      <MsiPackage Id='SDK' SourceFile='output\SDK_Kit.msi' Name='SDK' Visible='no' Vital ='yes'>
        <MsiProperty Name='INSTALLLOCATION' Value="[InstallFolder]"/>
        <MsiProperty Name='DESKTOP' Value="[MyCheckbox1]"/>
             
      </MsiPackage>
      <MsiPackage Id='driver1' SourceFile='output\Driversx86.msi' Name='Driversx86' InstallCondition='Not VersionNT64' Visible='no' ForcePerMachine='yes'>
        <MsiProperty Name='INSTALLLOCATION' Value="[InstallFolder]"/>
      </MsiPackage>
      <MsiPackage Id='driver2' SourceFile='output\Driversx64.msi' Name='Driverx64' InstallCondition='VersionNT64' Visible='no' ForcePerMachine='yes'>
        <MsiProperty Name='INSTALLLOCATION' Value="[InstallFolder]"/>
      </MsiPackage>
      
    </Chain>
  </Bundle>
  
  <Fragment>
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="Netfx35Version" />

    <PackageGroup Id="Netfx35">
      <ExePackage Id="Netfx35"
        Cache="no"
        Compressed="yes"
        PerMachine="yes"
        Permanent="yes"
        Vital="yes"
        Name="dotnetfx35.exe"
        SourceFile="..\..\files\dotnetfx35setup.exe"
        InstallCondition="NOT Netfx35Version OR (Netfx35Version &lt; v3.5.30729.1)"
        DetectCondition="Netfx35Version AND (Netfx35Version &gt;= v3.5.30729.1)">
        <ExitCode Value ="3010" Behavior="forceReboot" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>
index.asp - file version = 8.7.0.1
<% 
response.ContentType = "text/xml"
on error resume next
currentVersion = request.querystring("version")
url = "./SDK_Kit.exe"                // Set URL
size = "71,471 KB"               // Set size
// Write the response xml
response.Write "<?xml version=""1.0"" encoding=""utf-8""?>"
response.Write "<Setup>"
response.Write "  <Upgrade Url=""" & url & """ Size=""" & size & """ />
response.Write "</Setup>"
%>
With the above code it does not detect an upgrade, what am I missing?
Mar 8, 2013 at 2:45 PM
I think I found my issue, I will let you know in a bit
Mar 8, 2013 at 3:04 PM
<?php

header("Content-type: text/xml"); 

$currentVersion = $_GET['version'];

$url = "./SDK_Kit.exe";          
$size = "71,471 KB";


$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<Setup>\n";  
$xml_output .= "<Upgrade Url='$url'"  . " " . "Size='$size' />";
$xml_output .= "</Setup>\n";  

echo $xml_output; 
?>
totally forgot my hosting site is linux based so ASP will not work. I took your code and reworked it for PHP and everything is working. :)

The only thing can the bundle UI show the new version number of the application?
Coordinator
Mar 8, 2013 at 3:30 PM
Edited Mar 8, 2013 at 3:32 PM
The size variable should be the size in bytes without and extra characters.

I have not implemented anything to do that but it should be possible to add, I would suggest a new version attribute. If I get time I'll take a look.
Mar 8, 2013 at 3:50 PM
Thanks.


How does it know what file to check for the version number?

the reason why I ask is that I think there is an issue.
  1. I have two different installs both checking if there is an update
  2. Both EXE are located in the same folder on our hosting site
it seems like it looks at all of the exe in that folder instead of the one file name.
Coordinator
Mar 8, 2013 at 4:17 PM
The BA doesn't know anything about the updates, I did that on purpose so that all the logic was on the server. In my implementation I read the version number sent by the setup and then the asp code decides if there is an update and where it is. In my case we allowed minor updates but not major, e.g. 1.01 to 1.02 but not 1.02 to 2.00.
Mar 8, 2013 at 4:24 PM
ah so all logic is in the server code.

If a xml file is returned then it thinks there is an update, correct?
Coordinator
Mar 8, 2013 at 4:46 PM
Yes if there is an update set the Url attribute (see the example in the first reply above).
Mar 8, 2013 at 4:54 PM
Sorry totally missed that.

For anybody that is interested here is my final php code:
<?php

function get_product_version($file_name)
{
   $key = "P\x00r\x00o\x00d\x00u\x00c\x00t\x00V\x00e\x00r\x00s\x00i\x00o\x00n\x00\x00\x00";
   $fptr = fopen($file_name, "rb");
   $data = "";
   while (!feof($fptr))
   {
      $data .= fread($fptr, 65536);
      if (strpos($data, $key)!==FALSE)
         break;
      $data = substr($data, strlen($data)-strlen($key));
   }
   fclose($fptr);
   if (strpos($data, $key)===FALSE)
      return "";
   $pos = strpos($data, $key)+strlen($key);
   $version = "";
   for ($i=$pos; $data[$i]!="\x00"; $i+=2)
      $version .= $data[$i];
   return $version;
}


$currentVersion = $_GET['version'];


if (get_product_version("./Camera_Kit.exe") > $currentVersion)
{
    $url = "./Camera_Kit.exe";          
    $size = "20814613";
}
else
{
    $url = "";
    $size = "";
}

header("Content-type: text/xml"); 
    

$xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml_output .= "<Setup>\n";  
$xml_output .= "<Upgrade Url='$url'"  . " " . "Size='$size' />";
$xml_output .= "</Setup>\n"; 

echo $xml_output; 


?>