[wix-users] Colon in product name of WiX3 setup project throws an error
Hoover, Jacob
Jacob.Hoover at greenheck.com
Tue Oct 27 10:18:52 PDT 2020
Hrm, but the MakeValidLongFileName call should take care of the :. What version of WiX are you using?
private const string IllegalLongFilenameCharacters = @"[\\\?|><:/\*""]"; // illegal: \ ? | > < : / * "
private static readonly Regex IllegalLongFilename = new Regex(IllegalLongFilenameCharacters, RegexOptions.Compiled);
/// <summary>
/// Replaces the illegal filename characters to create a legal name.
/// </summary>
/// <param name="filename">Filename to make valid.</param>
/// <param name="replace">Replacement string for invalid characters in filename.</param>
/// <returns>Valid filename.</returns>
public static string MakeValidLongFileName(string filename, string replace)
{
return CompilerCore.IllegalLongFilename.Replace(filename, replace);
}
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Hoover, Jacob via wix-users
Sent: Tuesday, October 27, 2020 12:13 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Subject: Re: [wix-users] Colon in product name of WiX3 setup project throws an error
The log file name uses the project name, but : isn’t valid in a file name.
public string LogPathPrefixExtension
{
get { return (string)this.Fields[12].Data ?? String.Empty; }
set { this.Fields[12].Data = value; }
}
public string LogPrefix
{
get
{
string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':');
if (2 > logVariableAndPrefixExtension.Length)
{
return String.Empty;
}
string logPrefixAndExtension = logVariableAndPrefixExtension[1];
int extensionIndex = logPrefixAndExtension.LastIndexOf('.');
return logPrefixAndExtension.Substring(0, extensionIndex);
}
}
It also seems there is some field encoding of data…
Looks to me that the compiler needs to be fixed, and the proper answer is probably to just strip out the :’s from the name (or replace them with _’s):
private void ParseBundleElement(XmlNode node)
…
if (String.IsNullOrEmpty(name))
{
logVariablePrefixAndExtension = String.Concat("WixBundleLog:Setup.log");
}
else
{
// Ensure only allowable path characters are in "name" (and change spaces to underscores).
fileSystemSafeBundleName = CompilerCore.MakeValidLongFileName(name.Replace(' ', '_'), "_");
logVariablePrefixAndExtension = String.Concat("WixBundleLog:", fileSystemSafeBundleName, ".log");
}
From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>> On Behalf Of Danny Streichert via wix-users
Sent: Tuesday, October 27, 2020 11:26 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Cc: Danny Streichert <listen at dannypsilon.de<mailto:listen at dannypsilon.de>>
Subject: [wix-users] Colon in product name of WiX3 setup project throws an error
Hello,
is it normal that, if in an product name of an setup project a colon is,
a error from light.exe will throws?
I have a Bundle in which a x86 and a x64 msi is.
If there is a colon in my product name of a setup project and I call the
following:
"C:\Program Files (x86)\WiX Toolset v3.11\bin\Light.exe" -out
"C:\Dev\KKK\kkk SetupBundle\bin\Release\mmm_Setup.exe" -pdbout
"C:\Dev\KKK\kkk SetupBundle\bin\Release\mmm_Setup.wixpdb" -ext
"C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUtilExtension.dll"
-ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixBalExtension.dll"
-contentsfile "obj\Release\kkk
SetupBundle.wixproj.BindContentsFileList.txt" -outputsfile
"obj\Release\kkk SetupBundle.wixproj.BindOutputsFileList.txt"
-builtoutputsfile "obj\Release\kkk
SetupBundle.wixproj.BindBuiltOutputsFileList.txt" -wixprojectfile
"C:\Dev\KKK\kkk SetupBundle\kkk SetupBundle.wixproj"
obj\Release\Bundle.wixobj
the following error comes back:
light.exe : error LGHT0001 : Die Länge darf nicht kleiner als 0 (null) sein.
Parametername: length
Exception Type: System.ArgumentOutOfRangeException
Stack Trace:
bei System.String.Substring(Int32 startIndex, Int32 length)
bei Microsoft.Tools.WindowsInstallerXml.WixBundleRow.get_LogPrefix()
bei
Microsoft.Tools.WindowsInstallerXml.Binder.CreateBurnManifest(String
outputPath, WixBundleRow bundleInfo, WixBundleUpdateRow updateRow,
WixUpdateRegistrationRow updateRegistrationInfo, String path, List`1
allRelatedBundles, List`1 allVariables, List`1 orderedSearches,
Dictionary`2 allPayloads, ChainInfo chain, Dictionary`2 containers,
Dictionary`2 catalogs, Table wixBundleTagTable, List`1
approvedExesForElevation, Dictionary`2 commandLinesByPackage)
bei Microsoft.Tools.WindowsInstallerXml.Binder.BindBundle(Output
bundle, String bundleFile)
bei Microsoft.Tools.WindowsInstallerXml.Binder.Bind(Output output,
String file)
bei Microsoft.Tools.WindowsInstallerXml.Tools.Light.Run(String[] args)
Does anyone know this behavior and can help?
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<http://www.firegiant.com><http://www.firegiant.com<http://www.firegiant.com>>
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<http://www.firegiant.com/>
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
More information about the wix-users
mailing list