Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Another fix for WiX and dashes in the package id (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Mar 9, 2022
1 parent 6dc824a commit e32ed80
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/SquirrelCli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,16 @@ static async Task<string> createMsiPackage(string setupExe, IPackage package, bo
var setupExeDir = Path.GetDirectoryName(setupExe);
var setupName = Path.GetFileNameWithoutExtension(setupExe);
var culture = CultureInfo.GetCultureInfo(package.Language ?? "").TextInfo.ANSICodePage;

var templateText = File.ReadAllText(HelperExe.WixTemplatePath);

// WiX Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or
// periods(.). Every identifier must begin with either a letter or an underscore.
var wixId = Regex.Replace(package.Id, @"[^\w\.]", "_");
if (Char.GetUnicodeCategory(wixId[0]) == UnicodeCategory.DecimalDigitNumber)
wixId = "_" + wixId;

var templateData = new Dictionary<string, string> {
{ "Id", package.Id },
{ "Id", wixId },
{ "Title", package.ProductName },
{ "Author", package.ProductCompany },
{ "Version", package.Version.Version.ToString() },
Expand Down

0 comments on commit e32ed80

Please sign in to comment.