Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use RemoveFile Element?

641 views
Skip to first unread message

Ma liang

unread,
Feb 6, 2006, 12:07:26 AM2/6/06
to
Hi all,
I want to delete a file not copied by the file system.
However I want to delete it.
For instance,my product has installed into c:\program
files\Test
And there is a relative file named 1.txt that is saved in d:\saved files\1.
txt

The question is how to delete the file named 1.txt.
I have get the idea that I can use remove file,but I want the detail.

Thanks a lot.

Rob Hamflett

unread,
Feb 6, 2006, 5:13:02 AM2/6/06
to
The specific details will depend on what you're using to author the MSI. Here's the MSDN reference
for the RemoveFile table.

http://msdn.microsoft.com/library/en-us/msi/setup/removefile_table.asp?frame=true

Rob

iori

unread,
Feb 6, 2006, 11:00:24 AM2/6/06
to
you can also call vbscript from your installation to delete files


Ma liang

unread,
Feb 6, 2006, 9:02:58 PM2/6/06
to
Please tell me the detail
thanks a lot
maybe u can give me some codes of this
thanks.

Ma liang

unread,
Feb 6, 2006, 9:04:02 PM2/6/06
to
if u know how,please tell me the detail
give me any code that can help me
thanks

Rob Hamflett

unread,
Feb 7, 2006, 4:01:14 AM2/7/06
to
Again, if you want details we need to know what you're using to make the MSI.

Rob

Ma liang

unread,
Feb 7, 2006, 8:01:38 PM2/7/06
to
I use WIX to make the msi
3x again

Rob Hamflett

unread,
Feb 8, 2006, 4:57:26 AM2/8/06
to
Try something like

<Directory Id="SAVEDFILES" Name="savedf~1" LongName="saved files">
<Component Id="remfile" Guid="INSERT-GUID-HERE">
<RemoveFile Id="rem1.txt" Name="1.txt" On="uninstall"/>
</Component>
<Component Id="remfolder" Guid="INSERT-GUID-HERE">
<RemoveFolder Id="remsavedfolder" On="uninstall"/>
</Component>
</Directory>

and then have a property like this
<Property id="SAVEDFILES" Value="D:\saved files"/>

I used the property to set the path because I'm not sure how to specify a directory as being the D
drive. I've done this before and it works fine.

I've had some trouble with getting RemoveFile to work in the past, but hopefully this'll be OK.

Rob

Ma liang

unread,
Feb 8, 2006, 8:33:25 PM2/8/06
to
Thanks very much.

1.Another question is that: can I get the directory from the registry and
then use it as you tell me.
just like this:
<Property Id="INSTALLDIR">
<RegistrySearch Id="DotNetRegistry" Type="directory" Root="HKLM"
Key="Software\Microsoft\VisualStudio\7.1\Setup\VC#" Name="ProductDir" />
</Property>

Can I use the property above like this,
<Directory Id="INSTALLDIR" Name="savedf~1" LongName="saved files">


<Component Id="remfile" Guid="INSERT-GUID-HERE">
<RemoveFile Id="rem1.txt" Name="1.txt" On="uninstall"/>
</Component>
<Component Id="remfolder" Guid="INSERT-GUID-HERE">
<RemoveFolder Id="remsavedfolder" On="uninstall"/>
</Component>
</Directory>

2.Last question
Can I connect two property as one property,
that means one's value is "d:\test",the other's value is "test1",I want the
result as d:\test\test1

Can I get this?and how?

Thanks very much.

Rob Hamflett

unread,
Feb 9, 2006, 5:23:45 AM2/9/06
to
Ma liang wrote:
> Thanks very much.
>
> 1.Another question is that: can I get the directory from the registry and
> then use it as you tell me.
> just like this:
> <Property Id="INSTALLDIR">
> <RegistrySearch Id="DotNetRegistry" Type="directory" Root="HKLM"
> Key="Software\Microsoft\VisualStudio\7.1\Setup\VC#" Name="ProductDir" />
> </Property>
>
> Can I use the property above like this,
> <Directory Id="INSTALLDIR" Name="savedf~1" LongName="saved files">
> <Component Id="remfile" Guid="INSERT-GUID-HERE">
> <RemoveFile Id="rem1.txt" Name="1.txt" On="uninstall"/>
> </Component>
> <Component Id="remfolder" Guid="INSERT-GUID-HERE">
> <RemoveFolder Id="remsavedfolder" On="uninstall"/>
> </Component>
> </Directory>

Yeah, you can do this.


>
> 2.Last question
> Can I connect two property as one property,
> that means one's value is "d:\test",the other's value is "test1",I want the
> result as d:\test\test1
>
> Can I get this?and how?

You need to do it through a Custom Action, which will look something like this.

<CustomAction Id="setMyValue" Property="MyValue" Value="[Property1]\[Property2]"/>

You then need to sequence the Custom Action at some point before you need to use MyValue.

Rob
>
> Thanks very much.

0 new messages