3
votes

I'm using WIX 3.8 to create my setup file. This is my Product.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}" Name="My setup" Language="1033" Version="1.0.0.0" Manufacturer="Me" UpgradeCode="9279b740-8419-45c4-9538-6a45f8e949c7">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <Media Id="1" Cabinet="WCF.cab" EmbedCab="yes" />
        <Feature Id="ProductFeature" Title="Wcf.Setup" Level="1">
            <ComponentGroupRef Id="WCFComponents" />
        </Feature>
        <Property Id="WIXUI_INSTALLDIR" Value="INETPUB" />
    </Product>
    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="INETPUB" Name="Inetpub">
                <Directory Id="INSTALLFOLDER" Name="WCF">
                </Directory>
            </Directory>
        </Directory>
    </Fragment>
</Wix>

And here is the build file

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <WebSiteSource>..\WCF\</WebSiteSource>
        <SetupF>..\Setup\</SetupF>
        <PublishF>publish\</PublishF>
        <Publish>$(SetupF)$(PublishF)</Publish>
        <WebSiteContentCode>WebSiteContent.wxs</WebSiteContentCode>
        <WebSiteContentObject>WebSiteContent.wixobj</WebSiteContentObject>
        <MsiOut>bin\Release\WCF.msi</MsiOut>
        <WixPath>C:\PROGRA~2\WIXTOO~1.8\bin\</WixPath>
    </PropertyGroup>
    <ItemGroup>
        <WebSiteContent Include="$(WebSiteContentCode)" />
    </ItemGroup>
    <ItemGroup>
        <WixCode Include="Product.wxs" />
        <WixCode Include="$(WebSiteContentCode)" />
    </ItemGroup>
    <ItemGroup>
        <WixObject Include="Product.wixobj" />
        <WixObject Include="$(WebSiteContentObject)" />
    </ItemGroup>
    <Target Name="Build">
        <MSBuild
            Projects="..\TMS.sln"
            Targets="ReBuild"
            Properties="Configuration=Release" />
    </Target>
    <Target Name="PublishWebsite">
        <Message Text="Removing publish directory: $(SetupF)"/>
        <RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
        <Message Text="Start to publish website" Importance="high" />
        <MSBuild
            Projects="..\\WCF\WCF.csproj"
            Targets="ResolveReferences;_CopyWebApplication"
            Properties="OutDir=$(Publish)bin\;WebProjectOutputDir=
                        $(Publish);Configuration=Release" />
    </Target>
    <Target Name="Harvest">
        <Exec
            Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg WCFComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
            ContinueOnError="false"
            WorkingDirectory="." />
    </Target>
    <Target Name="WIX">
        <Exec
            Command='"$(WixPath)candle" -ext WixIISExtension -ext WixUtilExtension -ext WixSqlExtension -dpublishDir=$(Publish) -dMyWebResourceDir=. @(WixCode, &apos; &apos;)'
            ContinueOnError="false"
            WorkingDirectory="." />
        <Exec
            Command='"$(WixPath)light" -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixSqlExtension -out $(MsiOut) @(WixObject, &apos; &apos;)'
            ContinueOnError="false"
            WorkingDirectory="." />
        <Message Text="Install package has been created." />
    </Target>
    <Target Name="DeleteTmpFiles">
        <RemoveDir Directories="$(Publish)" ContinueOnError="false" />
        <RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
        <Delete Files="@(WixObject);@(WebSiteContent)" />
    </Target>
</Project>

I always receive the error message: Product.wxs(10): error LGHT0094: Unresolved reference to symbol 'WixComponentGroup:WCFComponents' in section 'Product:{D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92}'.

I copied exactly the source code from this topic http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/ to my project but the source code from here runs property but mine doesn't work.

Could you please help me to solve this problem? Thanks a lot.

1
My assumption is that a wxs file generated with heat.exe is placed into some directory, which is not included into the compilation. - Yan Sklyarenko
Thanks Yan for your answer, however I've declared the path to heat.exe already in WixPath variable - Phuc
No, I actually mean the directory, where the autogenerated file is placed. I assume that it is not included in further compilation, because it is located somewhere compiler can't find it. - Yan Sklyarenko
I ran the first command line to generate the harvest file C:\MyProject\MyProject.Setup>msbuild setup.build /t:Build;PublishWebSite;Harvest then it throws the error LGHT0094 immediately - Phuc

1 Answers

2
votes

I solved this problem by removing Build parameter from command line.

It should be:

msbuild setup.build /t:Build;PublishWebSite;Harvest;WIX;DeleteTmpFiles

The reason is you can’t build your solution because MyProject.Setup can’t be built.