This little utility grew out of need. I'm offering it up for free because it's so rough around the edges - no documentation, brute force approach, hardcoding, assumptions, etc. - you get what you paid for! It consists of a command script, a VBScript and an Xsl file - you can download it here. To use it, you also need another little utility I built which will generate a nested Xml directory listing that you can find here.
It will take an Xml directory file (from this previous utility) and generate a WiX 2.0 compatible fragment with the following features:
- DirectoryRef element so it can easily be referenced back to a Directory in a "controlling" WiX file.
- Component element for the web virtual directory with WebVirtualDir and WebApplication child elements.
- Component element representing the root of the web folder with a child elements for all Files found there, including both long and short names as needed.
- Nested Directory elements representing each of the sub folders under the root web folder (recursive) with all files.
- Ignores Visual SourceSafe (*.scc) files. ;)
- ComponentGroup element to pull together all the pieces of the web site so it can be easily referenced from a Feature (via ComponentGroupRef) in a "controlling" WiX file.
Of course, there's been limited testing (very limited, ok...I've only tested it on one project) so you may find some bugs. There's also some hardcoding and assumptions. Pay special attention near the top of the Xsl file where it's building the web virtual stuff (e.g. AllowSessions, DefaultWebSite, etc.). I didn't bother to get fancy and code for parameters.
Because of lack of time it carries a big assumption about the various artifact names - it uses the root folder name that you're building from. For example, if your web folder source is located at [C:\Inetpub\wwwroot\mywebsite] then it'll pick up "mywebsite" as the internal WiX name for the vdir, webapp, alias, etc. Finally, it picks up the auto generated GUIDs from the directory Xml ("ah, that's why he stuck them in there" ;) ) to use for component IDs and GUIDs. Therefore, this probably only has limited use as a first time tool since changing the GUIDs on each release of an MSI is generally frowned upon.
To use it simply drop the three files into your WiX build directory and invoke it from a command line: bldWebWxs "path_to_root_of_webFolder_source" wxsFilename
Hopefully, this will save you some time and get you most of the way there.