系统找不到我的源文件 - WiX
The system can't find my source file - WiX
我查看了有关 SO 的几个示例,但一直无法找到解决问题的方法。我正在尝试在 MSI 中指定源文件。这是我目前的代码片段。
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id ="FileAssociation" Guid="*">
<File Id="myapp.exe" Source="myapp.exe" />
</Component>
</Directory>
我知道 SourceDir
是必需的,但我不知道如何配置它。我正在手工编写代码,但我对 WiX 还是很陌生。目标是为 Java 代码制作一个安装程序。 setupBuilder 允许我构建 WiX 安装程序,但我必须定义 .wsx 配置以获得附加功能。最终目标是将自定义文件类型与我的应用相关联,但我什至无法在我的 MSI 中找到可执行文件。
到目前为止,我得到的错误是
error LGHT0103 : The system cannot find the file 'wblite_debug.exe'
.
我想我需要指定 SourceDir
以指向具有 MSI 安装程序的目录?我在正确的轨道上吗?
在 <File>
元素中,Source
属性指定在何处查找文件。
<File Id="wblite_debug.exe" Source="[path_to_file]\wblite_debug.exe" />
与SetupBuilder 合并出现一些问题,看来我必须做一些技巧。这是我提供给 SetupBuilder 以获取我正在寻找的文件关联的 wxs 文件。
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product>
<Component Id="FileAssociation" Directory="INSTALLDIR" Guid="*">
<CreateFolder/>
<ProgId Id ="file.file" Description="My File">
<Extension Id ="file" ContentType="application/file">
<Verb Id ="open" Command="open" TargetFile="_myapp.exe" Argument='"%1"'/>
<MIME ContentType="application/file" Default="yes" />
</Extension>
</ProgId>
</Component>
<DirectoryRef Id="INSTALLDIR">
<Component Guid="*" Id="_Comp">
<CreateFolder/>
<File Id="_myapp.exe" Name="myapp.exe" Source="loc\myapp.exe"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication">
<ComponentRef Id="FileAssociation"/>
</Feature>
</Product>
查看您的 WiX 代码,我发现您混淆了 MSI 目标文件夹路径和源文件夹路径。 Directory 标记用于在您 运行 MSI(您要部署应用程序的位置)的计算机上创建一个文件夹 - 它与您打包文件的源文件夹无关。
将您的文件路径替换为:
<File Id="wblite_debug.exe" Source= "\TESTfolder\wblite_debug.exe" KeyPath="yes"/>
可以看到,file -> source attribute路径要参考你的WXS文件路径来写。
我查看了有关 SO 的几个示例,但一直无法找到解决问题的方法。我正在尝试在 MSI 中指定源文件。这是我目前的代码片段。
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id ="FileAssociation" Guid="*">
<File Id="myapp.exe" Source="myapp.exe" />
</Component>
</Directory>
我知道 SourceDir
是必需的,但我不知道如何配置它。我正在手工编写代码,但我对 WiX 还是很陌生。目标是为 Java 代码制作一个安装程序。 setupBuilder 允许我构建 WiX 安装程序,但我必须定义 .wsx 配置以获得附加功能。最终目标是将自定义文件类型与我的应用相关联,但我什至无法在我的 MSI 中找到可执行文件。
到目前为止,我得到的错误是
error LGHT0103 : The system cannot find the file 'wblite_debug.exe'
.
我想我需要指定 SourceDir
以指向具有 MSI 安装程序的目录?我在正确的轨道上吗?
在 <File>
元素中,Source
属性指定在何处查找文件。
<File Id="wblite_debug.exe" Source="[path_to_file]\wblite_debug.exe" />
与SetupBuilder 合并出现一些问题,看来我必须做一些技巧。这是我提供给 SetupBuilder 以获取我正在寻找的文件关联的 wxs 文件。
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product>
<Component Id="FileAssociation" Directory="INSTALLDIR" Guid="*">
<CreateFolder/>
<ProgId Id ="file.file" Description="My File">
<Extension Id ="file" ContentType="application/file">
<Verb Id ="open" Command="open" TargetFile="_myapp.exe" Argument='"%1"'/>
<MIME ContentType="application/file" Default="yes" />
</Extension>
</ProgId>
</Component>
<DirectoryRef Id="INSTALLDIR">
<Component Guid="*" Id="_Comp">
<CreateFolder/>
<File Id="_myapp.exe" Name="myapp.exe" Source="loc\myapp.exe"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication">
<ComponentRef Id="FileAssociation"/>
</Feature>
</Product>
查看您的 WiX 代码,我发现您混淆了 MSI 目标文件夹路径和源文件夹路径。 Directory 标记用于在您 运行 MSI(您要部署应用程序的位置)的计算机上创建一个文件夹 - 它与您打包文件的源文件夹无关。
将您的文件路径替换为:
<File Id="wblite_debug.exe" Source= "\TESTfolder\wblite_debug.exe" KeyPath="yes"/>
可以看到,file -> source attribute路径要参考你的WXS文件路径来写。