WIX相对路径最终过长 [英] WIX relative path ends up being too long

查看:117
本文介绍了WIX相对路径最终过长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 light.exe 中收到错误消息,表明在定位安装项目中的文件之一时遇到了问题。在有问题的PC上发现我正在使用的相对路径超过260个字符。目前,Wix设置如下:

I am getting errors from light.exe that indicate it is having problems locating one of the files in my setup project. Turns out on the PC in question the relative path I am using exceeds 260 characters. At the moment Wix is set up something like this:

<File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='..\..\Path\To\Built\Executable\FoobarAppl10.exe' KeyPath='yes'/>

我遇到的问题是Wix安装项目位于<$ c $之类的文件夹中c> D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject 和 \Path\To\Built\Executable\FoobarAppl10.exe 存在于 D:\Path\To\ProjectFolder 文件夹下。当 light.exe 尝试解析路径时,最终结果为 D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject\ \..\..\Path\To\Built\Executable\FoobarAppl10.exe 在我的特殊情况下恰好超过260个字符。 exe的正确绝对路径应为 D:\Path\To\ProjectFolder\Path\To\Built\Executable\FoobarAppl10.exe 在我的情况下,该字符将少于260个字符,但是由于不必要地将路径的 WixInstallerixWixInstallerProject\..\..\ 部分包括在内然后超出此限制。

The problem I have is that the Wix install project is located in a folder such as D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject and \Path\To\Built\Executable\FoobarAppl10.exeexists under the D:\Path\To\ProjectFolder folder. When light.exe attempts to resolve the path the net result is D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject\..\..\Path\To\Built\Executable\FoobarAppl10.exe which in my particular case happens to be over 260 characters. The correct absolute path for the exe would be D:\Path\To\ProjectFolder\Path\To\Built\Executable\FoobarAppl10.exe which in my case would be under 260 characters, but because of the unnecessary inclusion of the WixInstaller\WixInstallerProject\..\..\ part of the path it is then over this limit.

有什么办法可以使 light.exe 解决 .. \..\Path\To\Built\Executable\FoobarAppl10.exe as D:\Path\To\ ProjectFolder\路径\构建\可执行文件\FoobarAppl10.exe ,而不是 D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject \..\..\Path\To\Built\Executable\FoobarAppl10.exe

Is there any way that I can get light.exe to resolve ..\..\Path\To\Built\Executable\FoobarAppl10.exe as D:\Path\To\ProjectFolder\Path\To\Built\Executable\FoobarAppl10.exe instead of D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject\..\..\Path\To\Built\Executable\FoobarAppl10.exe?

我很感谢这本身并不是Wix的限制,而是Wix设计要使用的API的构建方式的更多潜在限制,但是我需要一个解决问题的方法,使我可以在 .wxs 文件。是的,缩短路径是可以的,但是问题并不在于路径太长(因为不是),而是相对路径的语法增加了不必要的中间部分。

I appreciate this is not a limitation in Wix per se, more of an underlying limitation in the way the APIs Wix is designed to utilise are built, however I need a solution to the problem that will allow me to fix this in my .wxs file. Yes shortening the path would work but the problem isn't really that the path is too long (because it isn't), it's that the syntax for relative paths adds the unnecessary middle section.

推荐答案

今天, light.exe 中没有任何东西可以自定义评估路径,因此Path.Combine( )在整个字符数超过260个字符时不会窒息。如您所知,这是.NET Framework中令人沮丧的限制(Windows Installer API也将令人窒息)。

There isn't anything in light.exe today that will custom evaluate the path so that Path.Combine() doesn't choke when the whole thing is over 260 characters. As you note, it's a frustrating limitation in .NET Framework (and Windows Installer APIs will choke as well).

要解决此问题,建议您查看绑定路径。您可以将代码更改为:

To work around the issue, I would recommend looking into bind paths. You could change your code to be something like:

<File Id='FoobarEXE' Source='!(bindpath.FooBarApp)\FoobarAppl10.exe' />

在命令行上执行以下操作:

The on the command-line do something like:

light.exe -b FooBarApp=D:\Path\To\ProjectFolder\Path\To\Built\Executable

这将创建最短的路径。您也可以将相对路径从命令行移动到 File / @ Source (例如,将 Built\Executable 路径的一部分)。我想您会发现它非常灵活。

That will create the shortest paths. You can move relative paths from the command-line to the File/@Source as well (for example, move the Built\Executable part of the path). I think you'll find it's very flexible.

这篇关于WIX相对路径最终过长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆