WIX - 如何解决错误 LGHT0094:未解决的符号引用
Posted
技术标签:
【中文标题】WIX - 如何解决错误 LGHT0094:未解决的符号引用【英文标题】:WIX - how to resolve error LGHT0094: Unresolved reference to symbol 【发布时间】:2014-03-20 07:55:26 【问题描述】:我正在使用 WIX 3.8 创建我的安装文件。这是我的 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>
这是构建文件
<?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, ' ')'
ContinueOnError="false"
WorkingDirectory="." />
<Exec
Command='"$(WixPath)light" -ext WixIISExtension -ext WixUIExtension -ext WixUtilExtension -ext WixSqlExtension -out $(MsiOut) @(WixObject, ' ')'
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>
我总是收到错误消息:Product.wxs(10): error LGHT0094: Unresolved reference to symbol 'WixComponentGroup:WCFComponents' in section 'Product:D16E42B5-3C6F-4EE5-B2F4-727BF8B74A92'。
我将本主题 http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/ 的源代码完全复制到我的项目中,但此处的源代码运行属性,但我的不起作用。
你能帮我解决这个问题吗?非常感谢。
【问题讨论】:
我的假设是用heat.exe生成的wxs文件放在某个目录下,编译时不包含。 感谢 Yan 的回答,但是我已经在 WixPath 变量中声明了 heat.exe 的路径 不,我实际上是指放置自动生成文件的目录。我假设它不包含在进一步的编译中,因为它位于编译器找不到的地方。 我运行第一个命令行来生成收获文件 C:\MyProject\MyProject.Setup>msbuild setup.build /t:Build;PublishWebSite;Harvest 然后它立即抛出错误 LGHT0094 【参考方案1】:我通过从命令行中删除Build
参数解决了这个问题。
应该是:
msbuild setup.build /t:Build;PublishWebSite;Harvest;WIX;DeleteTmpFiles
原因是您无法构建解决方案,因为无法构建 MyProject.Setup
。
【讨论】:
嗨 @@Phuc ,我使用上述教程很好,但我仍然面临错误(WIX - 如何解决错误 LGHT0094:未解决的符号引用)。你能帮帮我吗 您应该在构建解决方案时排除安装项目,如您所遵循的教程中所述。以上是关于WIX - 如何解决错误 LGHT0094:未解决的符号引用的主要内容,如果未能解决你的问题,请参考以下文章
Wix (candle.exe) 中的符号错误 LGHT0311,windows-1252
错误 LGHT0204:ICE17:位图:控制的“WixUI_Bmp_Dialog”:对话框的“位图”:二进制表中找不到“WelcomeDlg”