[wix-users] Unable to Uninstall Patch
Ven H
venh.123 at gmail.com
Mon Jun 4 03:05:49 PDT 2018
One more quick point. In the Product.wxs above, if I added
ExecuteOnReinstall="yes" also in addition to ExecuteOnInstall=yes, then it
works during Patch also. But if I only have ExecuteOnInstall=yes, it
doesn't work during Patch. Please test it without ExecuteOnReinstall=yes
attribute. So, is this the solution? Is it correct? Please help.
Regards,
Venkatesh
On Mon, Jun 4, 2018 at 3:18 PM, Ven H <venh.123 at gmail.com> wrote:
> Thank you Edwin. Below is the complete detail.
>
> Basically, I have a Visual Studio MSI project with a Sample.txt and
> CREATE_TABLE.sql files at the root level. The Sample.txt has a text "This
> is version 1.0.0." and nothing else and the CREATE_TABLE.sql has an SQL
> statement to create a table as below.
>
> use TestDB
> go
>
> if not exists( select 1 from information_schema.tables where table_name =
> 'EMPLOYEES' )
> begin
> create table dbo.EMPLOYEES
> (
> EMP_ID INT NOT NULL,
> EMP_NAME NVARCHAR(100) NOT NULL
> )
> end
> go
>
> Following is the markup of Product.wxs
>
> *Product.wxs*
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="
> http://schemas.microsoft.com/wix/UtilExtension" xmlns:sql="
> http://schemas.microsoft.com/wix/SqlExtension">
> <Product Id="F3374DBE-A524-44FA-9052-4C6F88249F10" Name="DBPatchSample"
> Language="1033" Version="1.0.0.0" Manufacturer="DB_Patch_Sample"
> UpgradeCode="42855AC1-CE52-4366-B419-83503155C417">
> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
> />
>
> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
> already installed." />
> <MediaTemplate EmbedCab="yes" />
>
> <util:User Id="SQLUser" Name="[SQLUSER]" Password="[SQLPASSWORD]" />
>
> <Binary Id="binCreateTbl" SourceFile="CREATE_TABLE.sql" />
>
> <Property Id="MSIUSEREALADMINDETECTION" Value="1" />
> <Property Id="MSIFASTINSTALL" Value="1"/>
> <Property Id="MsiLogging" Value="v" />
> <Property Id="MSIENFORCEUPGRADECOMPONENTRULES" Value="1" />
> <Property Id="SQLSERVER" Value="ServerName"/>
> <Property Id="SQLINSTANCE" Value="InstanceName"/>
> <Property Id="SQLDB" Value="TestDB"/>
> <Property Id="SQLUSER" Value="sa"/>
> <Property Id="SQLPASSWORD" Value="Sa_Pwd"/>
>
> <Feature Id="ProductFeature" Title="DBPatchSample" Level="1">
> <ComponentGroupRef Id="DbCG" />
> </Feature>
> <UI Id="MyWixUI_Mondo">
> <UIRef Id="WixUI_Mondo" />
> </UI>
> <UIRef Id="WixUI_ErrorProgressText" />
> </Product>
>
> <Fragment>
> <Directory Id="TARGETDIR" Name="SourceDir">
> <Directory Id="ProgramFilesFolder">
> <Directory Id="INSTALLFOLDER" Name="DBPatchSample" />
> </Directory>
> </Directory>
> </Fragment>
>
> <Fragment>
> <ComponentGroup Id="DbCG">
> <Component Id="fileComp" Guid="92526A26-9404-449B-9EAA-7FC175F2EBE4"
> Directory="INSTALLFOLDER" KeyPath="yes">
> <File Id="sampleTxt" Name="Sample.txt" Source="Sample.txt" />
> </Component>
> <Component Id="dbComp1" Guid="B4E70B72-DB9C-4215-B4DF-022B56A26C01"
> Directory="INSTALLFOLDER" KeyPath="yes">
> <sql:SqlDatabase Id="msiTestDB1" Database="[SQLDB]"
> Server="[SQLSERVER]" Instance="[SQLINSTANCE]" CreateOnInstall="yes"
> User="SQLUser" />
> <sql:SqlScript BinaryKey="binCreateTbl" Id="script_CreateTbl"
> ExecuteOnInstall="yes" ExecuteOnReinstall="yes" ContinueOnError="no"
> SqlDb="msiTestDB1" Sequence="1" />
> </Component>
> </ComponentGroup>
> </Fragment>
> </Wix>
>
> With this, I created an MSI and installed it. It does create the table
> with the two columns in it. In the C:\Program Files(x86)\DBPatchSample
> folder, I could find only the Sample.txt file and not the CREATE_TABLE.sql.
> This is probably because the sql file is a binary and has been set to
> execute on install.
>
> In my bin/debug folder, I created 3 folders namely 1.0.0, 1.0.1 and Patch.
> Within 1.0.0 folder and 1.0.1 folders, I created a folder called "admin".
> In the Patch folder, I copied my Patch.wxs, whose markup is as given below.
> Then I moved the first MSI to 1.0.0 folder.
>
> *Patch.wxs *
>
> <?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.
> microsoft.com/wix/2006/wi">
> <PatchCreation WholeFilesOnly="yes" CleanWorkingFolder="yes"
> OutputPath="patch.pcp" Id="224C316C-5894-4771-BABF-21A3AC1F75FF">
> <PatchInformation Description="Patch Info Description" Comments="Patch
> Info Comments" Manufacturer="DB_Patch_Sample" Languages="1033"
> ShortNames="no" Compressed="yes"/>
> <PatchMetadata Description="Patch Metadata Description"
> ManufacturerName="DB_Patch_Sample" MoreInfoURL="URL_Here"
> AllowRemoval="yes" Classification="Update" DisplayName="DB Patch Sample
> Patch" TargetProductName="DBPatchSample"/>
> <Family MediaSrcProp="Sample" SequenceStart="5000" DiskId="5000"
> Name="Sample">
> <UpgradeImage SourceFile="D:\MyProjects\WIX\
> DBPatchSample\bin\Debug\1.0.1\admin\DBPatchSample.msi" Id="SampleUpgrade">
> <TargetImage Order="2" IgnoreMissingFiles="no"
> SourceFile="D:\MyProjects\WIX\DBPatchSample\bin\Debug\1.0.0\admin\DBPatchSample.msi"
> Id="SampleTarget"/>
> </UpgradeImage>
> </Family>
> <PatchSequence Supersede="yes" PatchFamily="SamplePatchFamily"
> Sequence="1.0.0.0"/>
> </PatchCreation>
> </Wix>
>
>
> Now, to create the 1.0.1, I only updated the CREATE_TABLE.sql as below.
>
> use TestDB
> go
>
> ALTER TABLE dbo.EMPLOYEES
> ADD LAST_NAME nvarchar(100)
>
> This is the only change. I also update the Version in Product.wxs to
> 1.0.1. That's it. I rebuilt this MSI and moved it inside 1.0.1 folder.
>
> Then I ran the following commands to create the Patch in a command prompt
> after changing to the appropriate directory (I am using PCP approach for
> Patch).
>
> msiexec.exe /a 1.0.0\DBPatchSample.msi /qb TARGETDIR=D:\MyProjects\WIX\
> DBPatchSample\bin\Debug\1.0.0\admin
>
> msiexec.exe /a 1.0.1\DBPatchSample.msi /qb TARGETDIR=D:\MyProjects\WIX\
> DBPatchSample\bin\Debug\1.0.1\admin
>
> candle.exe Patch\patch.wxs
>
> light.exe patch.wixobj -out patch\patch.pcp
>
> msimsp.exe -s patch\patch.pcp -p patch\patch.msp -l patch.log
>
> When I checked the Patch.log also, it is only try to compare the byte
> content of Sample.txt and not CREATE_TABLE.sql, even though only the sql
> file content has changed.
>
> After I install the patch, I can see the Update installed in ARP Installed
> Updates, but the DB changes are not reflected. There are no errors in the
> logs also. If I add the changes in a separate sql file within a new
> component, then the DB changes are reflected, but the Uninstall option in
> the ARP disappears. I am very confused. In case of SqlScript element, the
> sql file is actually not present physically in the machine and it gets
> executed during install. Hence I am not sure, if it is not able to capture
> it as a change. I would humbly request you to try out the above sample and
> check if it works or not and also please let me know what is missing /
> incorrect above. Please help.
>
>
> Regards,
> Venkatesh
>
> On Sat, Jun 2, 2018 at 12:53 AM, Edwin Castro <egcastr at gmail.com> wrote:
>
>> Use something like Orca or InstEdit to compare your old.msi and your
>> new.msi. InstEdit has a "Compare Against..." menu item under the
>> "Transform" menu which can help you see the differences easier. Look for
>> new rows in the tables listed on the page linked by Rob. I would expect
>> you're going to find new rows in one or more of those tables.
>>
>> --
>> Edwin G. Castro
>>
>>
>> On Fri, Jun 1, 2018 at 11:11 AM, Ven H via wix-users <
>> wix-users at lists.wixtoolset.org> wrote:
>>
>>> Thank you very much, Rob. In my case, I have the MsiPatchMetadata table
>>> in
>>> the Patch.msp, when opened using Orca and the other conditions are also
>>> fine.
>>>
>>> So, it looks like I am not getting how Patch works with SqlScript
>>> elements.
>>> It will be great, if someone can please explain how to create Patch for
>>> SqlScript for DB. I couldn't find much info on that.
>>>
>>> Regards,
>>> Venkatesh
>>>
>>> On Fri, Jun 1, 2018 at 9:57 PM, Rob Mensching via wix-users <
>>> wix-users at lists.wixtoolset.org> wrote:
>>>
>>> > https://msdn.microsoft.com/en-us/library/windows/desktop/
>>> > aa372102(v=vs.85).aspx
>>> >
>>> > _____________________________________________________________
>>> > Short replies here. Complete answers over there:
>>> > http://www.firegiant.com/
>>> >
>>> > -----Original Message-----
>>> > From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
>>> Ven
>>> > H via wix-users
>>> > Sent: Friday, June 1, 2018 6:22 AM
>>> > To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
>>> > Cc: Ven H <venh.123 at gmail.com>
>>> > Subject: Re: [wix-users] Unable to Uninstall Patch
>>> >
>>> > So, I think I need to explain a little more. I have an MSI which has a
>>> > text file in a component and SqlScript element in a different
>>> component. In
>>> > this SqlScript element, I am creating a table with 2 columns. I install
>>> > this MSI and the text file is created and the SqlScript is executed to
>>> > create the table with 2 columns in the Database.
>>> >
>>> > Now, I am adding another SqlScript element (here I am creating another
>>> > table with 2 columns) in a new component and also making a slight
>>> change in
>>> > the sample text file. With this, I create the patch using the Patch
>>> > Creation Properties approach. The patch gets created successfully and
>>> also
>>> > gets installed. After installation, I can see the new table created
>>> and the
>>> > sample text file modified. But now, when I go to Installed Updates, the
>>> > Uninstall option is missing for this patch, even though, I specify
>>> > AllowRemoval=yes.
>>> >
>>> > Now, instead of adding another SqlScript element, if I just modify the
>>> > existing SqlScript (I mean the binary sql file content), by altering
>>> the
>>> > table or adding another create table statement inside it, the patch
>>> doesn't
>>> > seem to apply these changes, although, now the Uninstall option is
>>> > available and I can uninstall the patch. I am not able to understand
>>> this.
>>> >
>>> > So, I have a couple of questions.
>>> >
>>> > 1. Why does the Uninstall option disappear for a Patch when a new
>>> > Component is added? I am actually not removing a component, but adding
>>> one.
>>> > So, I am not sure, if I am breaking the Component rules.
>>> >
>>> > 2. How do we Patch SqlScript elements? It is possible that, after
>>> > installation, the developer will make a small change in one of the sql
>>> > files. For this small change, I don't want to do a full upgrade.
>>> >
>>> > Please help.
>>> >
>>> >
>>> > Regards,
>>> > Venkatesh
>>> >
>>> > On Fri, Jun 1, 2018 at 4:28 PM, Ven H <venh.123 at gmail.com> wrote:
>>> >
>>> > > I am building a Patch using the Patch Creation Properties. I have a
>>> > > Patch.wxs in which there is a PatchMetadata element with
>>> > > AllowRemoval="yes". Even then the Patch doesn't give me the option to
>>> > > uninstall in the Installed Updates. Can any one please help?
>>> > >
>>> > > FYI, please find the Patch.wxs mark up below.
>>> > >
>>> > > <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
>>> > > <PatchCreation WholeFilesOnly="yes" CleanWorkingFolder="yes"
>>> > > OutputPath="patch.pcp" Id="224C316C-5894-4771-BABF-21A3AC1F75FF">
>>> > > <PatchInformation Description="!(loc.PatchDescription)"
>>> > > Comments="!(loc.PatchDescription)" Manufacturer="$(var.Manufactur
>>> er)"
>>> > > Languages="!(loc.LANG)" ShortNames="no" Compressed="yes"/>
>>> > > <PatchMetadata Description="!(loc.PatchDescription)"
>>> > > ManufacturerName="$(var.Manufacturer)" MoreInfoURL="URL"
>>> > > *AllowRemoval="yes"* Classification="Update" DisplayName="!(loc.
>>> > PatchDisplayName)"
>>> > > TargetProductName="$(var.ProductName)"/>
>>> > > <Family MediaSrcProp="Sample" SequenceStart="5000" DiskId="5000"
>>> > > Name="Sample">
>>> > > <UpgradeImage SourceFile="Path\1.0.1\admin\New.msi"
>>> > > Id="SampleUpgrade">
>>> > > <TargetImage Order="2" IgnoreMissingFiles="no"
>>> > > SourceFile="Path\1.0.0\admin\old.msi" Id="SampleTarget"/>
>>> > > </UpgradeImage>
>>> > > </Family>
>>> > > <PatchSequence Supersede="yes" PatchFamily="SamplePatchFamily"
>>> > > Sequence="1.0.0.0"/>
>>> > > </PatchCreation>
>>> > > </Wix>
>>> > >
>>> > >
>>> >
>>> > ____________________________________________________________________
>>> > WiX Toolset Users Mailing List provided by FireGiant
>>> > http://www.firegiant.com/
>>> >
>>> > ____________________________________________________________________
>>> > WiX Toolset Users Mailing List provided by FireGiant
>>> > http://www.firegiant.com/
>>> >
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>
>>
>
More information about the wix-users
mailing list