0

I've an ASP.NET project, a WIX installer project for it, and a build file for the installer. The build file:

  • Builds my project
  • Publishes the website into a directory (SetupFiles/publish/)
  • The WIX's heat.exe 'Harvest's the website's files
  • After that creates the installer with candle.exe and light.exe

I'd like to modify one of the config files (the Web.Release.config, which harvested from the SetupFiles/publish directory) during the install. I found the following code for it:

<Component Id="ChangeConfig" Guid="[YOUR_GUID_HERE]">
   <File Id="App.config" Name="MyApplication.exe.config" Vital="yes" KeyPath="yes" Source="[Path to project dir]\app.config" />
   <util:XmlFile Id="AppConfigSetConnStr" Action="setValue" Permanent="yes" File="[#App.config]"            
    ElementPath="/configuration/connectionStrings/add[\[]@name='MyDatabaseName'[\]]" Name="connectionString" 
    Value="Your Connection string values here" />
</Component>

From this question.

My problem is, what should I write into the File's tag Source attribute? If I write SetupFiles/publish/Web.Release.config, the light.exe gives the following error:

  D:\Works\Employer\MyProject12345\trunk\Project.Setup\SetConfigFile.wxs(7): er
ror LGHT0204: ICE30: The target file 'cktmp8gm.con|Web.Release.config' is insta
lled in '[TARGETDIR]\Inetpub\Proje\' by two different components on an LFN syst
em: 'cmpA0B9415D5BC7EAB6CA7F504326ED1B32' and 'ChangeConfig'. This breaks compo
nent reference counting. [D:\Works\Employer\MyProject12345\trunk\Project.Setup\
setup.build]

If I write simply Web.Release.config, the light.exe says it cannot find the file.

I tried [INSTALLDIR]/Web.Release.config (the INSTALLDIR is a variable in my setup project), but in this case the light.exe also says it cannot find the file.

Thanks for your help!

Community
  • 1
  • 1
Nagy Vilmos
  • 1,878
  • 22
  • 46

2 Answers2

0

Why do you want to change the web.release.config in the Wix project surely the Web.release.config has transforms in it which are applied to Web.config during the build process. If you need a different set of transforms then create a different build profile.

Once transformed the Web.config is then harvested included in your deployment package and Wix then needs to / can change this during the installation process as a result of options selected by the user. In this case you would use the xmlConfig action of the WixTolset. See the link below.

http://wixtoolset.org/documentation/manual/v3/xsd/util/xmlconfig.html

Hargrovm
  • 1,053
  • 8
  • 10
  • Yep, the second one is my situation. What should I write into the `File` attribute in the XmlConfig? – Nagy Vilmos Jul 06 '14 at 15:12
  • Assuming you have a variable in your Wix called [INSTALLLOCATION] then I would think your file attribute should be something like [INSTALLLOCATION]\web.config – Hargrovm Jul 06 '14 at 15:29
0

You have misunderstood how to use util:XmlFile. heat.exe has already made a component with <File Id="App.config" ... ? Correct? If yes - then you need to add the <util:XmlFile Id="AppConfigSetConnStr" Action="setValue" ... to this component.

I.e.:

<Component Id="heat_generated_something" ....>
  <File Id="heat_generated_app.config" ... />
  add this-> <util:XmlFile Id="AppConfigSetConnStr" Action="setValue" ... /> 
</Component>
Morten Frederiksen
  • 5,114
  • 1
  • 40
  • 72
  • Thanks for your reply. I've finished that project, and solved this problem in an other way, so I cannot try it. – Nagy Vilmos Jul 10 '14 at 14:55
  • @MortenFrederiksen it seems when I reference items from the heat generated data, WiX complains that I'm duplicating and ID, when really I'm just trying to reference it and add additional functionality to it. – Ultratrunks Dec 08 '16 at 20:16