如何在AppData中创建嵌套文件夹 [英] How to create nested folder in AppData

查看:78
本文介绍了如何在AppData中创建嵌套文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个将我的DApp安装到以太坊客户端中的安装程序.

I'm trying to create an installer that installs my DApp into ethereum client.

为此,我只需要将文件复制到%appdata%\Parity\Ethereum\dapps\mydappname中.所以我有这个标记,它在%appdata%\mydappname中创建一个文件夹:

To do so I just have to copy my files into %appdata%\Parity\Ethereum\dapps\mydappname. So I have this markup which creates a folder in %appdata%\mydappname:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="MyDapp" Language="1049" Version="1.0.0.0" 
             Manufacturer="Orbita" UpgradeCode="PUT-GUID-HERE" Codepage="1251">

      <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
      <MediaTemplate EmbedCab="yes"/>

        <Feature Id="ProductFeature" Title="MyDapp" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="AppDataFolder">
            <Directory Id="INSTALLFOLDER" Name="Fairs" />
          </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
          <Component Id="dapp" Guid="PUT-GUID-HERE">
            <RemoveFolder Id="INSTALLFOLDER" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" 
                           Type="string" Value="" KeyPath="yes" />
            <File Id="chain.json" Source="..\..\..\..\config\chain.json"/>
          </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

但是,当我更改嵌套结构时:

However, when I change structure to be nested:

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="AppDataFolder">
        <Directory Id="Parity" Name="Parity">
          <Directory Id="Ethereum" Name="Ethereum">
            <Directory Id="dapps" Name="dapps">
              <Directory Id="INSTALLFOLDER" Name="Fairs" />
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

我得到ICE64 s:

ICE64: The directory Parity is in the user profile but is not listed in the RemoveFile table.
ICE64: The directory Ethereum is in the user profile but is not listed in the RemoveFile table.
ICE64: The directory dapps is in the user profile but is not listed in the RemoveFile table.

标记有什么问题?我尝试将RemoveDirectory更改为

What's wrong with markup? I tried change RemoveDirectory to

<RemoveFolder Id="Parity" On="uninstall" />

但这是行不通的.

推荐答案

按用户与按机器 :安装到按用户文件夹(用户配置文件)为通常由于很多原因不建议使用.是否可以毫无问题地安装到每台机器上?您的应用程序是否需要从每个用户的文件夹中运行?

Per-User vs Per-Machine: Installing to per-user folders (user profile) is generally not recommended for many reasons. Is installing to a per-machine path out of the question? Does your application need to run from a per-user folder?

ICE64 :您似乎已在RemoveFolder element中省略了Directory attribute.

根据您的情况,这是必需的(因为Directory attribute默认为托管组件的安装目录,否则-在这种情况下不正确).

It is required in your case (since the Directory attribute defaults to the hosting components installation directory otherwise - which is incorrect in this case).

要解决您的验证错误,您应该可以执行以下操作:

To resolve your validation error you should be able to do something like this:

更改此:

<RemoveFolder Id="Parity" On="uninstall" />

对此:

<RemoveFolder Id="Parity" Directory="Parity" On="uninstall" />

对用户配置文件中存在的所有文件夹执行此操作.

Do this for all folders that exist in the user profile.

这是一个更大的WiX片段:

Here is a larger WiX blurb:

<Component Feature="MyFeature" Guid="PUT-GUID-HERE">

    <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Test"
                   Name="installed" Type="integer" Value="1" KeyPath="yes"/>

    <File Source="TestFile.txt" />

    <RemoveFolder Id="Parity" Directory="Parity" On="uninstall" />
    <RemoveFolder Id="Ethereum" Directory="Ethereum" On="uninstall" />
    <RemoveFolder Id="dapps" Directory="dapps" On="uninstall" />
    <RemoveFolder Id="INSTALLFOLDER" Directory="INSTALLFOLDER" On="uninstall" />

</Component>

这篇关于如何在AppData中创建嵌套文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆