2012-11-16 41 views
2

我已經得到了下面這個,但我想改變它的方式,它將Web應用程序安裝到現有的網站。目前它安裝的網站和所有的文件,但然後卸載也刪除所有的文件,我只是希望它作爲一個Web應用程序添加文件。我怎麼這樣做呢?Wix卸載整個網站不僅僅是應用程序

<?xml version="1.0" encoding="utf-8" ?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension" 
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 

    <Fragment> 
    <DirectoryRef Id="INSTALLLOCATION"> 
     <Component Id="C_IISWebsite" Guid="{138B3868-24E8-4D7B-8793-0D254AF349D4}" KeyPath="yes"> 
     <!-- This does not create a user, it's just an object that's referenced by the WebAppPool component --> 
     <util:User Id="WebAppPoolUser" CreateUser="no" Name="[WEB_APP_POOL_IDENTITY_USERNAME]" 
        Password="[WEB_APP_POOL_IDENTITY_PWD]" Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]"/> 

     <!-- The "Identity" attritbute below needs to be set to "other" to use the util:User defined above --> 
     <iis:WebAppPool Id="WebAppPool" Name="[WEB_APP_POOL_NAME]" Identity="other" User="WebAppPoolUser"/> 

     <iis:WebSite Id="DefaultWebSite" Description="[WEBSITE_NAME]" Directory="INSTALLLOCATION" > 
      <iis:WebAddress Id="AllUnassigned" Port="80"/> 
     </iis:WebSite> 

     <iis:WebVirtualDir Id="My.VirtualDir" Alias="mdxWebSite" Directory="INSTALLLOCATION" WebSite="DefaultWebSite"> 
      <iis:WebApplication Id="Application" Name="mdxWebSite" WebAppPool="WebAppPool" /> 
     </iis:WebVirtualDir> 
     </Component> 
    </DirectoryRef> 
    </Fragment> 
</Wix> 

回答

2

我認爲你的問題與安裝程序不知道要卸載什麼有關,因此刪除默認或父網站。看看this sample by John Robbins,關鍵是將配置存儲在註冊表中,以便卸載知道要刪除的內容,在您的<Component> ... </Compoonent>元素中執行以下操作應該這樣做,不要忘記插入適當的名稱/數據和guid。

<!--The component for installer properties I need to save so they can be used on the uninstall.--> 
<Component Id="SetupRegistryValues" Guid="{...}" KeyPath="yes" > 
<RegistryValue Root="HKLM" Key="SOFTWARE\CompanyName\ProductName\Install" Name="WebAppName" Value="[WEB_APP_NAME]" Type="string" /> 
<RegistryValue Root="HKLM" Key="SOFTWARE\CompanyName\ProductName\Install" Name="WebSiteName" Value="[WEBSITE_NAME]" Type="string" /> 
+1

這僅僅是通過描述「記住產權」模式的一部分Rob在他的博客中發表:http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Property-pattern。當您需要在安裝會話之間存儲值時(安裝/卸載/升級),這是推薦的解決方法, –

1

如果你想安裝Web應用程序&虛擬目錄,以現有的網站,也不想刪除您的網站,而卸載該產品;然後在一個單獨的片段下(不在任何組件內)定義您的網站。如下圖所示:

<Fragment> 
    <iis:WebSite Id="XYZ_WebSite" Description="Default Web Site"> 
     <iis:WebAddress Id="AllUnassigned" Port="80" /> 
    </iis:WebSite> 
    </Fragment> 

現在定義組件,如下部署Web應用程序\ Vdirs和節點是指該網站ID,:

<iis:WebVirtualDir Id="XYZ_VirtualDirectory_A" Alias="MyXYZ_V_ DIR" Directory="[MYDIR]" WebSite="XYZ_WebSite"> 
相關問題