在wix安装程序中添加资源文件 [英] Add resource files in wix installer

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

问题描述

我创建了一个多语言应用程序,该应用程序使用2个不同的资源文件来管理UI语言,因此,在我构建和执行程序时,在bin目录中,我有我的应用程序文件和两个文件夹,即en-GB和pt- PT。

I have created a multi lingual app that uses 2 diferent resource files to manage the UI language, so when I build and execute my program, in my bin directory I have my app files and two folders, en-GB and pt-PT.

我现在正在尝试使用Wix创建安装程序,为此,我定义了以下目录:

I am now trying to create a installer with Wix, for that I am defining the following directories:

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
         <Directory Id="INSTALLFOLDER" Name="App" >
            <Directory Id="LOCALEEN" Name="en-GB"/>
            <Directory Id="LOCALEPT" Name="pt-PT"/>
          </Directory>
      </Directory>
    </Directory>
  </Fragment>

然后,我定义以下组件:

And then, I define the following components:

 <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="App.resources.en.GB.dll" Guid="...">
        <CreateFolder />
        <File Id="App.resources.en.GB.dll" Name="App.resources.dll" Source="$(var.App.App_TargetDir)en-GB\App.resources.dll" />
      </Component>

    <Component Id="App.resources.pt.PT.dll" Guid="...">
        <CreateFolder />
        <File Id="App.resources.pt.PT.dll" Name="App.resources.dll" Source="$(var.App.App_TargetDir)pt-PT\App.resources.dll" />
      </Component>

    ... Other components...

    </ComponentGroup>
  </Fragment>

重建解决方案时出现以下错误:

When I rebuild my solution I get the following error:


'App.resources.dll'由LFN系统上的两个
不同组件安装在'[ProgramFilesFolder] \App\'中:'App.resources。 en.GB.dll和
App.resources.pt.PT.dll。这会中断组件引用计数。

'App.resources.dll' is installed in '[ProgramFilesFolder]\App\' by two different components on an LFN system: 'App.resources.en.GB.dll' and 'App.resources.pt.PT.dll'. This breaks component reference counting.

我知道这个问题,两个资源dll都被复制到安装文件夹中,而不是复制到特定文件夹中资源文件...但是我不知道如何解决它。任何人都可以提供有关如何解决此问题的提示?

I understand the problem, both resources dll are being copied to the installation folder, and not to the specific resources file... But I don't know how to solve it. Anyone can give any hints on how to solve this?

推荐答案

只需引用您想要组件所在的目录。 Directory = LOCALEEN 。无需指定< CreateFolder />
我也建议维护某种命名约定。您的组件和Fils具有相同的ID。参见 https://stackoverflow.com/a/1801464/4634044 。因此,这应该可以满足您的期望:

Just reference the directory where you want your components eg. Directory="LOCALEEN". There is no need to specify <CreateFolder /> I also recomend to maintain some kind of naming convention. Your Components and Fils have the same id. See https://stackoverflow.com/a/1801464/4634044. So this should do what you expect:

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <Component Id="C_EnglishLocale" Guid="..." Directory="LOCALEEN">
            <File Id="Fi_EnglishLocale" Name="App.resources.dll" Source="$(var.App.App_TargetDir)en-GB\App.resources.dll" />
        </Component>

        <Component Id="C_PolnishLocale" Guid="..." Directory="LOCALEPT">
            <File Id="Fi_PolnishLocale" Name="App.resources.dll" Source="$(var.App.App_TargetDir)pt-PT\App.resources.dll" />
        </Component>
    </ComponentGroup>
</Fragment>

这篇关于在wix安装程序中添加资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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