Alessandro
Alessandro

Reputation: 886

Add resource files in wix installer

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.

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' 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.

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?

Upvotes: 0

Views: 3214

Answers (1)

ChristianMurschall
ChristianMurschall

Reputation: 1701

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>

Upvotes: 1

Related Questions