Hi,
As part of major upgrade, I would like to copy one file from the previous 
version installed to some location. I want to do this only when a previous 
version of the product is installed. I don't want to do this CopyFile when this 
is a fresh installation.

Here is what I am trying :

Do a component search and get the full path of the file. Inside a component put 
a CopyFile element like:

<Property Id="OLDFILE" Secure="yes">
          <ComponentSearch Id="OldFileComponentSearch" Guid="{Guid1}" 
Type="file" />
</Property>

      <SetProperty Id="OLDFILEFULLNAME"
               Value="[OLDFILE]abc.xml" After="AppSearch"/>

<Component Id="MoveOldFile" Guid="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
KeyPath="yes">
          <Condition>![CDATA[OLDFILE]]</Condition>
          <CopyFile Id="CopyoldFile" DestinationDirectory="myDir" 
DestinationName="NewFile.xml"/>
</Component>


When the older version of the product is installed on the machine then this 
code actually copied the old file as expected.
But when there is no older version installed, this is still trying to do 
CopyFile and failing. I have tried to set the condition to 0 and even
then CopyFile is executed. Doesn't the condition apply for the CopyFile 
element? - It looks like this to me.

I tried one more thing as well. I put a File element inside the component 
element and inside that put the CopyFile element something like:

<Component Id=" MoveOldFile " Guid="xxxxxxxxxxxxxxxxxxxxxxxxxxxx" KeyPath="yes">
          <Condition><![CDATA[OLDFILE]]></Condition>
          <File Id="SomeDummyId" Source="SomeDummyFile.xml">
          <CopyFile Id=" CopyoldFile " DestinationDirectorymyDir" 
DestinationName="NewFile.xml"/>
          </File>
</Component>

Now, everything works expected. The copyfile is not executed if the condition 
is false but I cannot copy some other file than the file which is installed by 
this component. (I cannot set the PropertySource attribute of CopyFile if the 
CopyFile is nested under File element).

Is there some way that I can tackle this problem?

Thanks
Ram

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to