MSI (Wix) 创建目录、更改权限和复制文件

发布于 2024-11-27 20:54:31 字数 1354 浏览 1 评论 0原文

我正在努力让这个工作。他们的想法是将一些文件复制到在那里创建的目录中的 ALLUSERSFOLDER 中,该目录也需要更改其权限。

我尝试使用 ,;和 但我只设法创建了文件夹并更改了其权限,但没有复制(移动)文件,这里是 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>

I'm struggling to get this working. They idea is to copy some files to ALLUSERSFOLDER in a directory created there which also needs it's permissions changed.

I have try using <CreateFolder>, <util:PermissionEx> and <CopyFile> but I only managed to get the folder created and its pemissions changed but not to copy (move) the files, here is the 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2024-12-04 20:54:31

你可以试试这个代码。创建文件夹并更改文件夹的权限后,调用此自定义操作

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

You can try this code. Call this custom action once you have create the folder and changed permissions on the folder

<CustomAction Id="C_SetQtCmdLineMoveFiles" Property="QtExecCmdLine"
   Value=""[SystemFolder]cmd.exe" /c move/Y "[ALLUSERSFOLDER]storage\*.log" "[ALLUSERSFOLDER]NewFolder"" />
<CustomAction Id="QtCmdMoveFiles" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文