[wix-users] Issues in WiX Patch in Visual Studio

Ven H venh.123 at gmail.com
Thu Oct 26 11:22:40 PDT 2017


I have created a solution in Visual Studio 2017 for trying out Patch in
WiX. I have 2 Wix Setup Projects (v3). I was following the Wix tutorials
from FireGiant and also some other articles. I named the first project as
PatchSample_Error and the second one as PatchSample_Fixed. In both the
projects, I have a wxs file and a text file (InstallMe.txt) in both the
projects. The text contents are slightly different in both cases. The wxs
file Error.exs has the following contents.

Error.wxs
-----------

<?xml version='1.0' encoding='Windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0 Patch Sample'
Id='50045BA6-84BB-443E-9EE2-65C818892F64'
UpgradeCode='78E62CB9-A5BE-408A-98A2-F28DF5CB96E9'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme
Ltd.'>

    <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0
Installer"
      Comments='Foobar is a registered trademark of Acme Ltd.'
Manufacturer='Acme Ltd.'
      InstallerVersion='100' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />

    <Media Id='1' Cabinet='PatchSample.cab' EmbedCab='yes'
DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
    <Property Id="MSIFASTINSTALL" Value="1"/>
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='AcmePatchSample' Name='AcmePatchSample'>
          <Directory Id='INSTALLDIR' Name='Foobar 1.0 Patch Sample'>

            <Component Id='MainExecutable'
Guid='0555C79B-59A9-4F4C-BCF7-0336F8411112'>
              <File Id='InstallMeText' Name='InstallMe.txt' DiskId='1'
Source='InstallMe.txt' KeyPath='yes' />
            </Component>

          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
    </Feature>

  </Product>
</Wix>


The wxs file Fixed.wxs has the following contents.

Fixed.wxs
---------
<?xml version='1.0' encoding='Windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0 Patch Sample'
Id='50045BA6-84BB-443E-9EE2-65C818892F64'
UpgradeCode='78E62CB9-A5BE-408A-98A2-F28DF5CB96E9'
    Language='1033' Codepage='1252' Version='1.0.1' Manufacturer='Acme
Ltd.'>

    <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0
Installer"
      Comments='Foobar is a registered trademark of Acme Ltd.'
Manufacturer='Acme Ltd.'
      InstallerVersion='100' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />

    <Media Id='1' Cabinet='PatchSample.cab' EmbedCab='yes'
DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
    <Property Id="MSIFASTINSTALL" Value="1"/>
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='AcmePatchSample' Name='AcmePatchSample'>
          <Directory Id='INSTALLDIR' Name='Foobar 1.0 Patch Sample'>

            <Component Id='MainExecutable'
Guid='0555C79B-59A9-4F4C-BCF7-0336F8411112'>
              <File Id='InstallMeText' Name='InstallMe.txt' DiskId='1'
Source='InstallMe.txt' KeyPath='yes' />
            </Component>

          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
    </Feature>

  </Product>
</Wix>

The Solution has a patch file also, called Patch.wxs, with the following
contents.

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Patch AllowRemoval='yes' Manufacturer='Acme Ltd.' MoreInfoURL='
www.acmefoobar.com'
    DisplayName='Foobar 1.0.1 Patch' Description='Small Update Patch'
Classification='Update'>

    <Media Id='5000' Cabinet='PatchSample.cab'>
      <PatchBaseline Id='PatchSample' />
    </Media>

    <PatchFamily Id='SamplePatchFamily' Version='1.0.0.0' Supersede='yes'>
      <ComponentRef Id='MainExecutable' />
    </PatchFamily>

  </Patch>
</Wix>

In the first project (SamplePatch_Error), I have the following commands in
the Post Build event.

candle.exe  "$(ProjectDir)Error.wxs" -out "Error.wixobj"
light.exe -xo "Error.wixobj" -out "Error.wixout"
xcopy "$(TargetDir)Error.wixout" "$(SolutionDir)Output" /Y /I
xcopy "$(SolutionDir)Patch.wxs" "$(SolutionDir)Output" /Y /I

In the second project (SamplePatch_Fixed), I have the following commands in
the Post Build event.

candle.exe  "$(ProjectDir)Fixed.wxs" -out "Fixed.wixobj"
light.exe -xo "Fixed.wixobj" -out "Fixed.wixout"
xcopy "$(TargetDir)Fixed.wixout" "$(SolutionDir)Output" /Y /I
torch.exe -p -xi "$(SolutionDir)Output\Error.wixout"
"$(SolutionDir)Output\Fixed.wixout" -out "$(SolutionDir)Output\diff.wixmst"
candle.exe "$(SolutionDir)Output\Patch.wxs" -out
"$(SolutionDir)Output\Patch.wixobj"
light.exe "$(SolutionDir)Output\Patch.wixobj" -out
"$(SolutionDir)Output\Patch.wixmsp"
pyro.exe "$(SolutionDir)Output\Patch.wixmsp" -out
"$(SolutionDir)Output\Patch.msp" -t PatchSample
"$(SolutionDir)Output\diff.wixmst"

When I compile the second project, build fails saying "The System cannot
find the file InstallMe.txt" (from the Fixed.wxs of SamplePatch_Fixed
project). I am not able to understand why this happening or how to fix this
error.

When I tried from the command line, I am getting the error in Pyro command
(Null reference exception).
Can anyone please help?

Regards,
Venkatesh


More information about the wix-users mailing list