1

Just starting with WiX (at version 3.8), we're surprised that it doesn't seem at all straightforward to deploy a website with WiX. Not yet concerned about any infrastructure aspects like IIS or custom actions to tailor the setup, or even whether we precompile the site, just would be happy to deploy a trivial website to a folder. But the only file that ever gets deployed is a single dll (whose name appears to be derived from the AssemblyName property configured in the csproj).

After some googling, we tried setting Harvest=True on the project reference, and adding <EnableProjectHarvesting>True</EnableProjectHarvesting> to the wixproj file. But only that same dll ever gets deployed. (Orca shows it to be the only file in the MSI file table.)

Adding the following to the wixproj succeeds in getting Heat, Candle and Light to process a set of files from a hard-coded folder, but does not succeed in deploying anything else: still only the one dll is included in the MSI file table.

<Target Name="BeforeBuild">
    <!-- try hardcoded path -->
 <HeatDirectory 
  ToolPath="$(WixToolPath)" 
  OutputFile="%(ProjectReference.Filename).wxs" 
  Directory="C:\Dev\2010\HelloWixWebApplication\HelloWixWebApplication" 
  GenerateGuidsNow="true"
  DirectoryRefId="TARGETDIR"
  />
 <!-- some properties that Candle will use, so we should be able to to tell it to look in this folder for the .wks -->
 <PropertyGroup>
  <!--IncludeSearchPaths>.</IncludeSearchPaths -->
  <CompilerAdditionalOptions>%(ProjectReference.Filename).wxs</CompilerAdditionalOptions>
  <!--and one for Light: -->
  <LinkerAdditionalOptions>obj\Debug\%(ProjectReference.Filename).wixobj</LinkerAdditionalOptions>
 </PropertyGroup>
</Target>

Returning to the main question, and the thing that would really help but we can't seem to find: an actual example of deploying a simple asp.net website using WiX. Anyone? TIA.


In reply to Rob Mensching's question, the additional .wxs file that gets generated from this config is shown below. (Ignore the mis-spelled HellowWix.. which I corrected elsewhere.)

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Directory Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997" Name="HellowWixWebApplication" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir6DED4C9E136E741825339CEA6DE213D8">
            <Component Id="cmp04A9076B920B178A9BB40ABB0D0C5785" Guid="{C6AA8596-0107-4360-85B1-503CC6F319FA}">
                <File Id="fil021D16CABEED58F6659FD4103DD68AC4" KeyPath="yes" Source="SourceDir\bin\HellowWixWebApplication.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmp19A9163AE8A7925CB6C4247D145B22B6" Guid="{D7B85294-12DF-4784-B6DA-BF7AEBA475C9}">
                <File Id="fil24F0BD7A232604DB4D8E369EFDB7AB28" KeyPath="yes" Source="SourceDir\Web.Release.config" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmp22213FE3CD8C99A9A7563D7AFD66052E" Guid="{99E59BF6-640B-4E35-B4D8-671927AF9BD3}">
                <File Id="fil4AA1682891BEFAA2AB3CB1ABCBE9C155" KeyPath="yes" Source="SourceDir\HellowWixWebApplication.csproj" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmp277C2DBCB4DB3C289C46A9784423A2C1" Guid="{7DF707B0-55BF-4899-805C-97A1A2081528}">
                <File Id="filE62AD3DD98C8055C24348922079D0E2E" KeyPath="yes" Source="SourceDir\Default.aspx.designer.cs" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmp2E90B366B07FD51B623E7CF089E2932D" Guid="{17914BB7-5A02-499B-AC0C-F1F9FCB6019F}">
                <File Id="filC05278F3F8EB3611EB1EBB30F6EA4AFB" KeyPath="yes" Source="SourceDir\Web.config" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmp3025675392247E7856146E4D28076668" Guid="{2905F7E7-536B-44E5-8C10-45A954CE9E86}">
                <File Id="fil8EB5092298D94AE4C4677473CAAFC0E0" KeyPath="yes" Source="SourceDir\Web.Debug.config" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir6E0901CF23FF0CE2677DE6B8BBA3B8BD">
            <Component Id="cmp7C99050A7370BF342937DF8E86BA1863" Guid="{5DF80AF2-1459-43CD-A649-90AB1F2C57AE}">
                <File Id="filB73CA61225E396C5CD26B29E8FAA7AFE" KeyPath="yes" Source="SourceDir\obj\Debug\HellowWixWebApplication.pdb" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir4F5CB8DBC18741F08CCFF2B59DDE3481">
            <Component Id="cmp976F1DA49CEA0FDDB2D0EA8C756C7DCF" Guid="{1069A669-F349-427F-B01A-64E942AFED2F}">
                <File Id="fil21676E8D65B4C460832839007C43343E" KeyPath="yes" Source="SourceDir\Properties\AssemblyInfo.cs" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmpA0C26A291B35A1F7C8F75C76C408C355" Guid="{51AE16C4-A743-4EFA-8678-064A6550F228}">
                <File Id="fil9A7337716828B5F0F975E4B424B18285" KeyPath="yes" Source="SourceDir\Default.aspx.cs" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir6E0901CF23FF0CE2677DE6B8BBA3B8BD">
            <Component Id="cmpAA37E12AC25051F1FB98359B5654CBB6" Guid="{4D81902A-9F6C-47D8-95AF-ED1D7062771C}">
                <File Id="fil053D1EA59D1DC9708FA9DF93DCE32BF2" KeyPath="yes" Source="SourceDir\obj\Debug\HellowWixWebApplication.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir6E0901CF23FF0CE2677DE6B8BBA3B8BD">
            <Component Id="cmpAB40655D2EEBFE8E7DA2D5C008705F7A" Guid="{01C5537C-257D-4472-BB27-778DDB5E2CEA}">
                <File Id="fil1B67F0463CE8AA35030E31A3E3BFA82D" KeyPath="yes" Source="SourceDir\obj\Debug\HellowWixWebApplication.csproj.FileListAbsolute.txt" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dir6E0901CF23FF0CE2677DE6B8BBA3B8BD">
            <Component Id="cmpD72354FE851F86AF61BFD2B884E05B34" Guid="{230F8CC1-9DF3-4B44-B6C8-617090329C82}">
                <File Id="filBF0022433A84B60F69F4ECF6724E4BA3" KeyPath="yes" Source="SourceDir\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmpEA2E4AE70EBEAF6FCFC294661CE9EF29" Guid="{ADE9B8A8-F4CC-4CE7-845F-5C526A9E6149}">
                <File Id="fil76F4E5B6801E021CFE962F5C33DEA62F" KeyPath="yes" Source="SourceDir\Default.aspx" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Component Id="cmpEC68C3F57C9E201E67744CC0DA54E083" Guid="{42F553F5-90B1-4190-A6BC-1DD41928F151}">
                <File Id="fil4B42859DA454D34945962FBFB3BFB0C1" KeyPath="yes" Source="SourceDir\HellowWixWebApplication.csproj.user" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Directory Id="dir4F5CB8DBC18741F08CCFF2B59DDE3481" Name="Properties" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Directory Id="dir6DED4C9E136E741825339CEA6DE213D8" Name="bin" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirAD6B115F080FDBD956168CB7C622647C">
            <Directory Id="dir6E0901CF23FF0CE2677DE6B8BBA3B8BD" Name="Debug" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="dirE7F2BE36CFADC3ED9ACCB1F42198C997">
            <Directory Id="dirAD6B115F080FDBD956168CB7C622647C" Name="obj" />
        </DirectoryRef>
    </Fragment>
</Wix>
2
  • What does your .wxs file look like? Commented Mar 20, 2013 at 19:35
  • Now addded above. Thanks. Commented Mar 21, 2013 at 9:35

2 Answers 2

1

To include the generated files they need to be within a component which is then included in a feature.

Easiest way for you to do this is to modify the HeatDirectory element changing it to:

<HeatDirectory 
    ToolPath="$(WixToolPath)" 
    OutputFile="%(ProjectReference.Filename).wxs" 
    Directory="C:\Dev\2010\HelloWixWebApplication\HelloWixWebApplication" 
    GenerateGuidsNow="true"
    DirectoryRefId="TARGETDIR"
    ComponentGroupName="ContentFiles"
    SuppressFragments="true" />

adding the ComponentGroupName and SupressFragments parameters. Then include that component in your feature by using the <ComponentGroupRef Id="ContentFiles" /> element.

I usually also add the SuppressUniqueIds attribute so it is a bit nicer to read.

Personally I prefer to then take that generated wxs and include it directly in my project and update when new files are included. That way it is exactly how I want it. The other option is to use a xslt transform to strip out the stuff you don't need like the csproj etc. and supply in the Transform attribute.

Sign up to request clarification or add additional context in comments.

4 Comments

Yeah, what @caveman_dick said except I'd leave SuppressFragments on (but I like to leave the door open for patching).
Thanks, that sheds some light but there's now a build error for each file, The system cannot find the file 'SourceDir\Default.aspx'. Evidently it is finding the files in my hardcoded directory, as the filenames are shown in these build errors. Why then does it say the same file can't be found in "SourceDir"?
What you need to do is set PreprocessorVariable=var.ContentFiles this will then enable you to set ContentFiles in the <DefineConstants>ContentFiles=$(ContentFiles)</DefineConstants> Property in the wixproj project. The $(ContentFiles) property can then be set via msbuild parameters. If you have no requirement to switch the source directory then you can just specify the path directly in the <DefineConstants> tag.
It would be nice that a project that built in 3.6 would continue to build in 3.8 with out having to change anything. Putting things in the actual csproj file versus just adding Product.Generated entry is a real pain. Bring back the harverst in VS2013!
0

There is now a Visual Studio extension VDProj to WiX Converter which can be downloaded from the Tools menu, Extensions and Updates. There is also another WIX-related extension there, which is a designer for creating and manipulating Wix setup projects:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.