2017-05-08 55 views
0

我創建了一個使用2個不同資源文件來管理UI語言的多語言應用程序,因此當我構建並執行我的程序時,在我的bin目錄中我有我的應用程序文件和兩個文件夾, en-GB和pt-PT。在wix安裝程序中添加資源文件

現在我想創建與維克斯一個安裝程序,對於我定義了以下目錄:

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

然後,我定義了以下組件:

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

當我重建我的解決方案我得到以下錯誤:

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

我明白這個問題,無論是水庫ources DLL正在被複制到安裝文件夾,而不是特定的資源文件...但我不知道如何解決它。任何人都可以提供關於如何解決這個問題的提示?

回答

1

只需引用您想要組件的目錄,例如。 Directory="LOCALEEN"。沒有必要指定<CreateFolder /> 我也建議保持某種命名約定。您的組件和Fils具有相同的ID。見https://stackoverflow.com/a/1801464/4634044。所以這應該做你所期望的:

<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> 
+0

是的,這是做的伎倆,謝謝。 – lulas