2011-01-18 14 views
8

Background: Ho un programma di installazione Wix in cui viene creata una directory virtuale in un sito Web IIS esistente. La directory virtuale viene creata (non esiste prima dell'installazione) ma il sito Web IIS dovrebbe già essere creato (l'utente sceglie solo un sito Web da installare in un ListBox).Il percorso fisico del sito Web IIS diventa vuoto su wix uninstall

Il problema: Dopo la disinstallazione, il percorso fisico del sito Web IIS installato è vuoto, nessun valore per quell'attributo. Di seguito una versione ridotta del mio file wix principale. Non sono sicuro del motivo per cui la disinstallazione influisce sul sito Web IIS, ma qualsiasi idea è apprezzata.

Note: Sono su Wix 3.5 e Windows Server 2008 R2, IIS 7.

<Product> 

    <Property Id='WEBSITE_DESCRIPTION'> 
     <RegistrySearch Id='RememberPropertyWEBSITE_DESCRIPTION' Root='HKCU' 
     Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' 
     Type='raw' /> 
    </Property> 

    <Property Id='WEBSITE_PORT'> 
     <RegistrySearch Id='RememberPropertyWEBSITE_PORT' Root='HKCU' 
     Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' 
     Type='raw' /> 
    </Property> 


    <Component Id='PropertiesToSave' Directory='ApplicationFolder'> 
     <RegistryValue Root='HKCU' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsiteDescription' Value='[WEBSITE_DESCRIPTION]' 
     Type='string' /> 
     <RegistryValue Root='HKCU' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsitePort' Value='[WEBSITE_PORT]' 
     Type='string' /> 

     <RemoveFolder Id='CleanupApplicationFolder' On='uninstall' /> 
    </Component> 


    <Directory Id='TARGETDIR' Name='SourceDir'> 
     <Component Id='TestWebVirtualDirComponent' Guid='12345678-6304-410E-A808-E3585379EADB'> 
     <CreateFolder /> 
     <iis:WebVirtualDir Id='TestWebVirtualDir' Alias='[WEBSITE_VIRTUALDIR]' Directory='TARGETDIR' WebSite='MyWebsite'> 
      <iis:WebApplication Id='TestWebApplication' Name='Test' /> 
     </iis:WebVirtualDir> 
     </Component> 
    </Directory> 

    <iis:WebSite Id="MyWebsite" Description="[WEBSITE_DESCRIPTION]" SiteId="*"> 
     <iis:WebAddress Id="AllUnassigned" Port="[WEBSITE_PORT]" /> 
    </iis:WebSite> 

    <Feature> 
     <ComponentRef Id='TestWebVirtualDirComponent'/> 
     <ComponentRef Id='PropertiesToSave'/> 
    </Feature> 
</Product> 
+0

Ho usato WIX (3,0 nel mio caso) per un'installazione di IIS legati, anche, e ho trovato un paio di sorprese e difetti. In alcuni casi ho dovuto ricorrere a azioni personalizzate per farlo funzionare come previsto. – Cheeso

risposta

5

WiX IIsExtension riconosce il WebSite per Descrizione attributo e l'attributo Porto di bambino WebAddress elemento. Quindi, quando installi la tua applicazione, imposti WEBSITE_DESCRIPTION e WEBSITE_PORT in qualche modo. Tuttavia, quando si esegue la disinstallazione, le proprietà menzionate non sono impostate e si ottiene il comportamento descritto.

La soluzione è salvare i valori delle proprietà richieste nel registro di sistema e utilizzare l'elemento RegistrySearch per leggere i valori e impostare le proprietà appropriate. Questo è chiamato pattern "Remember Property" ed è perfettamente spiegato da Rob Mensching here.

+0

Ciao Yan. Lo sto facendo davvero, ho modificato l'esempio di codice qui sopra per mostrare quello che sto facendo. Un "Repair" funziona come previsto, c'è un po 'che devo fare "on uninstall"? –

+1

Secondo il vostro campione suppongo che ci si aspetterebbe che una directory virtuale venisse cancellata al momento della disinstallazione. Se è vero, dovresti anche "ricordare" la proprietà WEBSITE_VIRTUALDIR. Oltre a questo, non sembra sospetto e dovrebbe funzionare. Hai riscontrato errori specifici durante la disinstallazione? O semplicemente lascia la directory virtuale lì? –

+0

Ciao Yan, sì, questo era il problema. Il salvataggio della directory virtuale ha reso tutto correttamente nell'universo. –

0

si deve registrare nel registro anche [VirtualDir] e [STSWEBALIAS] proprietà
così come [WEBSITE_DESCRIPTION] e [WEBSITE_PORT].
Ecco soluzione completa che ha funzionato per me e la mia squadra:

<Property Id='WEBSITE_DESCRIPTION' Value='Default Web Site'> 
    <RegistrySearch Id='RememberPropertyWEBSITE_DESCRIPTION' Root='HKLM' 
    Key='SOFTWARE\Company\Product' Name='InstalledWebsiteDescription' 
    Type='raw' /> 
</Property> 

<Property Id='WEBSITE_PORT' Value='90'> 
    <RegistrySearch Id='RememberPropertyWEBSITE_PORT' Root='HKLM' 
    Key='SOFTWARE\Company\Product' Name='InstalledWebsitePort' 
    Type='raw' /> 
</Property> 

<Property Id='VIRTUALDIR'> 
    <RegistrySearch Id='RememberPropertyWEBSITE_VIRT' Root='HKLM' 
    Key='SOFTWARE\Company\Product' Name='InstalledWebsiteVirtDir' 
    Type='raw' /> 
</Property> 

<Property Id='STSWEBALIAS'> 
    <RegistrySearch Id='RememberPropertyWEBSITE_STS' Root='HKLM' 
    Key='SOFTWARE\Company\Product' Name='InstalledWebsiteSts' 
    Type='raw' /> 
</Property> 


<DirectoryRef Id="TARGETDIR"> 
    <Component Id='PropertiesToSave' Guid='{384F2559-E7CF-40D2-A2D3-347DBFD15711}'> 
    <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsiteDescription' Value='[WEBSITE_DESCRIPTION]' 
     Type='string' /> 
    <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsitePort' Value='[WEBSITE_PORT]' 
     Type='string' /> 
    <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsiteVirtDir' Value='[VIRTUALDIR]' 
     Type='string' /> 
    <RegistryValue Root='HKLM' Key='SOFTWARE\Company\Product' 
     Name='InstalledWebsiteSts' Value='[STSWEBALIAS]' 
     Type='string' /> 
    </Component> 
</DirectoryRef> 

<Feature Id="Saves"> 
    <ComponentRef Id='PropertiesToSave'/> 
</Feature> 
Problemi correlati