2012-11-16 38 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"> 
相关问题