Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wix.Core.Common: Bring back '.' capability for 'loc'/'wix' variables. #561

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wix/WixToolset.Core/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static string GenerateIdentifier(string prefix, params string[] args)
/// <summary>
/// Return an identifier based on provided file or directory name
/// </summary>
/// <param name="name">File/directory name to generate identifer from</param>
/// <param name="name">File/directory name to generate identifier from</param>
/// <returns>A version of the name that is a legal identifier.</returns>
internal static string GetIdentifierFromName(string name)
{
Expand Down Expand Up @@ -767,7 +767,7 @@ internal static bool TryParseWixVariable(string value, int start, out ParsedWixV
var end = equalsDefaultValue == -1 ? closeParen : equalsDefaultValue;
var secondDot = value.IndexOf('.', firstDot + 1, end - firstDot);

if (secondDot == -1)
if ( (secondDot == -1) || (ns != "bind") )
{
name = value.Substring(firstDot + 1, end - firstDot - 1);
}
Expand Down
6 changes: 6 additions & 0 deletions src/wix/test/WixToolsetTest.Core/VariableResolverFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public void CanRecursivelyResolveVariables()
{ "ProductName", new BindVariable() { Id = "ProductName", Value = "Localized Product Name" } },
{ "ProductNameEdition", new BindVariable() { Id = "ProductNameEdition", Value = "!(loc.ProductName) Enterprise Edition" } },
{ "ProductNameEditionVersion", new BindVariable() { Id = "ProductNameEditionVersion", Value = "!(loc.ProductNameEdition) v1.2.3" } },
{ "ProductNameEditionVersion.WithDot", new BindVariable() { Id = "ProductNameEditionVersion.WithDot", Value = "Test of localization variable with dot" } },
{ "ProductNameEditionVersion.WithDotTest", new BindVariable() { Id = "ProductNameEditionVersion.WithDotTest", Value = "!(loc.ProductNameEditionVersion.WithDot) v1.2.3" } },
};

var localization = new Localization(0, null, "x-none", variables, new Dictionary<string, LocalizedControl>());
Expand All @@ -45,6 +47,10 @@ public void CanRecursivelyResolveVariables()
WixAssert.StringEqual("Welcome to Localized Product Name Enterprise Edition v1.2.3", result.Value);
Assert.True(result.UpdatedValue);

result = variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEditionVersion.WithDotTest)");
WixAssert.StringEqual("Welcome to Test of localization variable with dot v1.2.3", result.Value);
Assert.True(result.UpdatedValue);

result = variableResolver.ResolveVariables(null, "Welcome to !(bind.property.ProductVersion)");
WixAssert.StringEqual("Welcome to !(bind.property.ProductVersion)", result.Value);
Assert.False(result.UpdatedValue);
Expand Down
Loading