Take the 2-minute tour ×

I need to be able to copy a file that exists on the target machines hard-drive based on a registry setting that holds the folder path.

I have been trying to get this going for a day or two and am having difficulty, can anyone help?



share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Try something along these lines:

<Component Id="MyComponent" Guid="E5FF53DE-1739-42c4-BE37-60F810C9CD69">  
 <CopyFile Id="fileToCopy.datCopy" SourceName="[MYTESTDIR]fileToCopy.dat" DestinationProperty="WEBSERVICEBINFOLDER" /> 

You can populate MYTESTDIR with a value from the registry using a RegistrySearch.

share|improve this answer
add comment

You can first search your registry for the file as follows:

<Property Id="PROPERTYNAME" Secure="yes">
  <RegistrySearch Id="SomeID"
    <DirectorySearch Id="REQUIREDDIRECTORY" AssignToProperty="yes" Depth="1" Path="THEEXPECTEDPATH">

Then use a Custom Action to set the file name

      <CustomAction Id="SETFILE"
      Value="[PROPERTYNAME]file.extension" />

and then copy file as described by the previous answer...

      <CopyFile Id="fileToCopy.datCopy" SourceName="[FILE]" DestinationProperty="[YOURDESTINATION]" />
share|improve this answer
add comment

Your Answer


