在AppData中制作WIX安装程序放置文件 [英] Make WIX installer place files in AppData

查看:105
本文介绍了在AppData中制作WIX安装程序放置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Windows的以太坊客户端编写一个dapp.为了使dapp对用户可用,我必须将特定文件放在appdata的文件夹中.所以我只应该将一些文件放在%appdata%\Parity\Ethereum\dapps\mydappname中.但是我总是在WIX上遇到奇怪的错误,最后一个是

I'm writing a dapp for ethereum client for windows. In order to make dapp available for user I have to place specific files in the folder in appdata. So I just should place some files in %appdata%\Parity\Ethereum\dapps\mydappname. But I always get weird errors with WIX, the last one is

错误93 ICE64:目录dapp在用户配置文件中,但不在 列在RemoveFile表中.

Error 93 ICE64: The directory dapp is in the user profile but is not listed in the RemoveFile table.

我有以下myapp.wixproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>3.10</ProductVersion>
    <ProjectGuid>8beed2e4-8784-4cb5-8648-cdf55c5defe6</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>FairsDapp</OutputName>
    <OutputType>Package</OutputType>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <PropertyGroup>
    <DefineConstants>HarvestPath=dapp</DefineConstants>
  </PropertyGroup>      
  <ItemGroup>
    <Compile Include="Product.wxs" />
    <Compile Include="Dapp.wxs" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
  <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
    <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
  </Target>
  <Target Name="BeforeBuild">
  <HeatDirectory
    DirectoryRefId="INSTALLFOLDER"
    OutputFile="Dapp.wxs"
    Directory="dapp"
    ComponentGroupName="SourceComponentGroup"
    ToolPath="$(WixToolPath)"
    PreprocessorVariable="var.HarvestPath"
    AutogenerateGuids="true" />
  </Target>
</Project>

并跟随wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix
    xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="Dapp" Language="1049" Version="1.0.0.3" Manufacturer="Me" UpgradeCode="fb09dccc-6606-4b5d-8dcb-28146c28663a" Codepage="1251">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MediaTemplate EmbedCab="yes"/>
        <Feature Id="ProductFeature" Title="FDapp" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="AppDataFolder">
                <Directory Id="Parity">
                    <Directory Id="dapps">
                        <Directory Id="INSTALLFOLDER" Name="F2"></Directory>
                    </Directory>
                </Directory>
            </Directory>
        </Directory>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"></ComponentGroup>
    </Fragment>
</Wix>

我发现必须使用heat任务来创建正确的文件树,但是现在我陷入了简单的任务在用户计算机上复制这些文件".

I found that I have to use heat task to create a correct files tree, but now I'm stuck with simple task "copy these files on user machine".

推荐答案

我不熟悉这种类型的应用程序(用于Windows的以太坊客户端的dapp)-因此,建议必须是通用的.

I am unfamiliar with this type of application (dapp for ethereum client for windows) - so the advice has to be generic I am afraid.

每用户文件&注册表设置 :通常,使用MSI很难将文件部署到用户配置文件和HKCU设置.正如Chris所指出的那样,除非您主动添加结构以将文件复制到所有用户配置文件中,否则它基本上只适用于安装MSI的用户,即使这样也很笨拙.

Per-User Files & Registry Settings: In general deploying files to the user profile and HKCU settings is difficult with MSI. As Chris points out it basically just works for the user installing the MSI, unless you actively add constructs to get files copied to all user profiles, and even then it is sort of clunky.

方法 :很久以前,我就以下主题写了很长的答案:

Approaches: I wrote a long answer a long time ago on the subject: Create folder and file on Current user profile, from Admin Profile (long and elaborate, but without any automagic solutions).

首选方法 :在涉及过多复杂性之前,最简单的方法通常是使用应用程序在首次启动时为每个用户复制用户配置文件-无需使用安装程序来安装用户特定的文件.

Preferred Approach: Before getting involved in too much complexity, the easiest approach is generally to use your application to copy the userprofile files in place for every user on first launch - instead of using the setup to install user-specific files.

这要求有一个单独的应用程序可执行文件,通常通过其自己的快捷方式启动-可能不是吗?例如,通常不适用于插件.

This requires that there is a separate application executable to launch, generally via its own shortcut - which it might not be? It generally does not work for addins for example.

  • 方法1 :每台计算机安装模板文件,然后将其复制到每个计算机 用户在应用程序启动时的用户个人资料.

  • Approach 1: Install template files per-machine and then copy them to each user's userprofile on application launch.

方法2 :或者,我想直接从服务器下载文件 或数据库,并放入用户个人资料-也在首次启动时.

Approach 2: Alternatively I like to download files directly from a server or database and put in the userprofile - also on first launch.

是否应用更新? :如果存在以下情况,有多种方法可以确保您可以重新复制文件: 更改您的模板,如下所述:

Apply Updates?: There are ways to ensure that you can re-copy files if there are changes to your templates as described here: http://forum.installsite.net/index.php?showtopic=21552 (Feb 2019 converted to WayBack Machine link).


错误 :您报告的特定问题与针对用户配置文件位置的所有文件夹都需要一个按用户的注册表项路径和一个RemoveFolder条目有关: /p>


Errors: The specific problem you report has to do with the need for a per-user registry key path and a RemoveFolder entry for all folders targeting userprofile locations:

  <Directory Id="AppDataFolder">
    <Directory Id="Parity">
      <Directory Id="dapps">
        <Directory Id="INSTALLFOLDER" Name="F2">
          <Component Guid="{77777777-7777-7777-7777-7777777777DD}" Feature="MainApplication">

            <RegistryKey Root="HKCU" Key="Software\TestManufacturer\TestApp">
              <RegistryValue Name="Flag" Value="1" Type="string" KeyPath="yes" />
            </RegistryKey>

            <RemoveFolder Id="RemoveINSTALLFOLDER" Directory="INSTALLFOLDER" On="uninstall" />
            <RemoveFolder Id="RemoveParity" Directory="Parity" On="uninstall" />
            <RemoveFolder Id="Removedapps" Directory="dapps" On="uninstall" />

            <File Source="Test.exe" />
          </Component>
        </Directory>
      </Directory>

这只是MSI的惯例和怪癖之一. 如前所述, 每台计算机安装所有文件,然后将其复制到用户配置文件中 该应用程序代替.它将使它们脱离任何设置 干扰未来 .然后,您无需处理这些RemoveFolder问题.

This is just one of MSI's conventions and quirks. As already stated, install all files per-machine and copy them to the userprofile with the application instead. It will dis-entangle them from any setup interference in the future. Then you do not need to deal with these RemoveFolder issues.


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