我正在为WCF服务创建安装程序。安装程序将从用户输入虚拟目录名称,域名,用户名和密码,并将创建应用程序。 IIS中具有用户标识和虚拟目录的池。它还在C:\ Intetpub \ WWWRoot \ path创建目录。我希望该目录的名称与虚拟目录路径的名称相同,但在代码下方创建名称为“[WEB_APP_NAME]”的目录。我已经浏览了一些线程,表明这可以使用自定义操作完成。我在Wix中很新,我不知道我需要在下面的代码中做出哪些更改。有人可以指导我..? 以下是我的代码:
<Fragment>
<?include ConfigurationInitialize.wxi ?>
<Property Id="IISROOT">
<RegistrySearch Id="IISROOT"
Type="directory"
Root="HKLM"
Key="Software\Microsoft\InetStp"
Name="PathWWWRoot" />
</Property>
<!--<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />-->
<!-- TODO: Put your code here. -->
<!-- The root of life for any installer. -->
<Directory Id='TARGETDIR' Name='SourceDir'>
<!-- Install into the ISS root directory we found earlier. -->
<Directory Id="IISROOT" Name='WebDir'>
<!-- Here's this installers install location. -->
<Directory Id='INSTALLDIR'
Name='[WEB_APP_NAME]'> <!-- THIS NAME SHOULD BE SAME AS THE NAME OF VIRTUAL DIRECTORY IN IIS-->
<Directory Id='bin' Name='bin'></Directory>
<!-- The component to define the Virtual Directory.-->
<Component Id="WebVirtualDirComponent"
Guid="BE6C585A-9FB1-4109-86A4-4059F18F9C90">
<util:User Id="MyWebAppPoolUser"
CreateUser="no"
Name="[WEB_APP_POOL_IDENTITY_NAME]"
Password="[WEB_APP_POOL_IDENTITY_PWD]"
Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />
<iis:WebAppPool Id="MyAppPool" Name="MyAppPool"
ManagedPipelineMode="Integrated" ManagedRuntimeVersion="v4.0" Identity="other" User="MyWebAppPoolUser" ></iis:WebAppPool>
<!-- The virtual directory we are installing. -->
<!-- The Alias attribute is the name thata will be put into IIS.-->
<!-- The Directory attribute is the "Physical Path" property in
IIS and needs to tie to an ID specified in the setup. -->
<!-- The WebSite attribute ties to a <WebSite> element in the
setup file. As this is an example of installing into the
"Default Web Site" that element is not under a component.-->
<iis:WebVirtualDir Id="VDir"
Alias="[WEB_APP_NAME]"
Directory="INSTALLDIR"
WebSite="DefaultWebSite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="TestWebApplication"
Name="[WEB_APP_NAME]"
WebAppPool="MyAppPool"/>
</iis:WebVirtualDir>
<!-- This is pretty important. If the CreateFolder isn't there the
WebVirtualDir won't get created as there's no files in this
component.
http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg03483.html -->
<CreateFolder/>
</Component>
</Directory>
</Directory>
</Directory>
答案 0 :(得分:0)
您是否尝试使用自定义操作?
您可以使用以下自定义操作之一在安装期间更改属性值:
例如:
<CustomAction Id="ChangeDir" Directory="INSTALLFOLDER" Value="[SomeValueorPropertyhere]"/>
2.在InstallExecution阶段安排行动(必须在CostFinalize步骤之后):
<Custom Action="ChangeDir" After="CostFinalize"></Custom>