Wix installer CopyFile move file not working

Viewed 227

I want to move a file from one Directory to another and it simply does nothing.

Here is the part from my Product.wxs:

<Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1">
  <ComponentRef Id="testCopy"/>
</Feature>

<DirectoryRef Id="dirConfigs">
  <Component Id="web.config" Guid="8736259D-4FEE-4826-B109-76DD3B0EDAE7">
    <CopyFile Id="CopyWebConfig" 
              SourceProperty="dirProject"
              SourceName="Web.config"
              DestinationProperty="dirConfigs"
              DestinationName="Web.config"
              />
  </Component>
</DirectoryRef>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="$(var.PlatformProgramFilesFolder)">
    <Directory Id="dirParent" Name="$(var.CustomerName)">
      <Directory Id="dirProject" Name="$(var.ProductName)">
        <Directory Id="dirConfigs" Name="$(var.ConfigFolderName)">
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Directory>

Edit I also tried with Source/DestinationDirectory instead of Source/DestinationProperty Any ideas? Thanks in advance!

1 Answers

I would rely on a deferred CustomAction invoking the command line "copy" command rather than using CopyFile and execute it, like in this SO question.

You'll need admin permissions if you are going to write the file in a protected folder or a folder requiring administrative access (on Windows Vista+, anything outside the %USER% folder.

Related