2011-08-04 172 views
2

我很努力使這項工作。他們的想法是將一些文件複製到ALLUSERSFOLDER中創建的目錄中,這也需要更改權限。MSI(Wix)創建目錄,更改權限和複製文件

我嘗試使用<CreateFolder>, <util:PermissionEx> and <CopyFile>但我只是設法讓文件夾中創建和pemissions改變,但不復制(移動)的文件,這裏是XML:

<Directory Id="ProgramFilesFolder"> 
     <Directory Id="APPLICATIONROOTDIRECTORY" Name="MyApp"> 
      <Directory Id="PFSTORAGE" Name="storage"/> 
     </Directory>    
</Directory> 

<Directory Id="CommonAppDataFolder"> 
     <Directory Id="ALLUSERSFOLDER" Name="MyApp"> 
       <Directory Id="AUSTORAGE" Name="storage"/>      
      </Directory> 

      <Component Id="AllUsersFiles" Guid="{F8765AB2-D78B-4A38-9FF4-DEEC1ACE6509}"> 
       <CreateFolder> 
        <util:PermissionEx User="Everyone" GenericAll="yes"/> 
       </CreateFolder> 
       <CopyFile Id="copy" DestinationProperty="AUSTORAGE" SourceProperty="PFSTORAGE" SourceName="*.*" Delete="yes" /> 
       <RegistryKey Root="HKCU" Key="Software\MyApp\install"> 
          <RegistryValue Value="installing" Type="string" KeyPath="yes" /> 
       </RegistryKey> 
      </Component> 
</Directory> 

回答

-1

你可以試試這個代碼。在創建文件夾並更改文件夾的權限後調用此自定義操作

<CustomAction Id="C_SetQtCmdLineMoveFiles" Property="QtExecCmdLine" 
    Value="&quot;[SystemFolder]cmd.exe&quot; /c move/Y &quot;[ALLUSERSFOLDER]storage\*.log&quot; &quot;[ALLUSERSFOLDER]NewFolder&quot;" /> 
<CustomAction Id="QtCmdMoveFiles" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore" />