Showing posts with label WiX. Show all posts
Showing posts with label WiX. Show all posts

Friday, May 4, 2012

Wix: where is my web application created?

Installing a web application, I want to select on wich web site it suppose to be created.
So, I let's say I have 2 web sites:

Default Web Site listening on *:80
Test Web Site listening on *:8080

In my wix code I write smth like that:

<iis:WebSite Id='SelectedWebSite'
                 Description='[WEBSITE_NAME]'
                 Directory='INSTALLDIR'>
      <iis:WebAddress Id="AllUnassigned" Port="80"/>
</iis:WebSite>

AND I put this under Product, since I am not interested in my web site being created on install and removed on uninstall, i.e. I ask user to choose from existing web sites (details see here: http://wix.sourceforge.net/manual-wix3/iis_xsd_website.htm)

So far so good. Moving on - to virtual dir and web application itself.
Under dedicated component  write this:
     
 <iis:WebVirtualDir Id="VDir"
                                Alias="[WEB_APP_NAME]"
                                Directory="INSTALLDIR"
                                WebSite="SelectedWebSite">
           <iis:WebApplication Id="MyWebAppApplication"
                                             WebAppPool="SelectedAppPool"
                                             Name="[WEB_APP_NAME]" />
           <iis:WebDirProperties Id="SelectedWebSite_Properties"
                                                AnonymousAccess="yes" 
                                                WindowsAuthentication="no"
                                                DefaultDocuments="Default.aspx" />
</iis:WebVirtualDir>              
                        
So I start installation and select Test Web Site to install under. What do I expect? Virtual directory and web application being created under selected web site.
But hold on, it is not that easy!

In that case, virtual directory is located under the right place, but web application ended up under Default Web Site. Why is that? Becouse it is Default Web Site listening to *:80, and that(*:80) is specified in iis:WebAddress part under iis:WebSite.
Just to make sure, I changed  to <iis:WebAddress Id="AllUnassigned" Port="8080"/> - and vuala, this time my web application ended up under correct Test Web Site.

Interesting...


Sunday, April 1, 2012

Wix + TFS : problem with building on x64 build agents

I ran into interesting problem recently, trying to build wix custom action project on our build agent (simple wix project had no problem).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1360): Could not resolve this reference. Could not locate the assembly "Microsoft.Deployment.WindowsInstaller". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
The worst part was that when I logged in to the machine and built same stuff from visual studio – it worked as a charm.
So, after some investigation, I found that on x64 machines Wix installer writes its information only under wow6432Node. And naturally, x64 MSBuild process can’t find them.

Solution 1:
Add new string  as HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\WiX 3.5 with value set to C:\Program Files (x86)\Windows Installer XML v3.5\SDK\(same as under Wow6432Node - HKLM\SOFTWARE\Wow6432Node\Microsoft\.NET
Framework\AssemblyFolders\WiX 3.5)

Solution 2: 
(which turned to be much easier) choose to run MSBuild on x86 (when edit build definition)


Hope that helps somebody :)