Mise à jour de l'app.config de WIX l'installation?
Je suis en train Wix 3.6 et c'est à quoi il ressemble maintenant :
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="myappINSTALLDIR" Name="myapp5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="myapp5.WindowsService.exe" Name="myapp5.WindowsService.exe" Source="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe" KeyPath='yes'/>
...
<ServiceInstall Id="InstallmyappService" DisplayName="myappService" Name="myapp5.WindowsService.exe" Description="myapp 5 Service - För effektivare och enklare operationsplanering" Account="LocalSystem" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlmyappService" Name="myapp5.WindowsService.exe" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</Directory>
</Directory>
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
Maintenant, j'ai besoin d'ajouter une boîte de dialogue pour le Wix installation où l'on appSetting et un baseadress(WCF) est définie à l'application.config. Cela doit être fait avant l'installation, car il va décider le nom de Windows Service que Wix est installning.
Et exampel serait génial!
Edit 1:
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)\Image\myappTopBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)\Image\myappDialogBackground.bmp" />
<Property Id="SERVICEADDRESS" Value="http://serviceaddress"/>
<Property Id="WIXUI_INSTALLDIR" Value="myappINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<util:XmlFile Id="UpdateBaseAddress"
Action="setValue"
File="$(var.myapp.WindowsService.TargetDir)\myapp5.WindowsService.exe.config"
SelectionLanguage="XPath"
Permanent="yes"
ElementPath="/configuration/applicationSettings/ServiceName"
Name="baseAddress" Value="[SERVICEADDRESS]" />
<Feature Id="ProductFeature" Title="Wix_myapp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
OriginalL'auteur Banshee | 2012-12-20
Vous devez vous connecter pour publier un commentaire.
Vous pouviez ajouter une référence à l'WixUtilExtension.dll le projet de l'installateur, puis utilisez XmlFile mettre à jour l'application.config comme:
Notez que vous aurez besoin de définir le répertoire et le nom de l' .fichier de configuration (vous pouvez simplement utiliser $(var.ProjectName.TargetFileName).config qui devrait travail pour vous automatiquement
selon les docs
XmlFile
doit résider dansComponent
élément.Notez que pour utiliser de Daniel réponse, vous aurez besoin de définir
util
en ajoutantxmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
à la racine de votre<Wix />
élément.Si c'est votre app réglage
<appSettings><add key="MyAppSetting" value="OldValue"/></appSettings>
, puis à la bonne échapper seraitElementPath="/configuration/appSettings/add[\[]@key='MyAppSetting'[\]]" Name="value" Value="NewValue"
Comment cette poignée de mises à niveau?
OriginalL'auteur Daniel Morritt