Re-enable MSI usage of only a "." in Directory/@Name

This commit is contained in:
Rob Mensching 2021-04-08 10:32:40 -07:00
Родитель 399ab500b7
Коммит 999621b156
3 изменённых файлов: 68 добавлений и 1 удалений

Просмотреть файл

@ -4216,7 +4216,14 @@ namespace WixToolset.Core
fileSourceAttribSet = true;
break;
case "Name":
name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, allowRelative: true);
if ("." == attrib.Value)
{
name = attrib.Value;
}
else
{
name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, allowRelative: true);
}
nameAttribute = attrib;
break;
case "ShortName":

Просмотреть файл

@ -88,6 +88,53 @@ namespace WixToolsetTest.CoreIntegration
}
}
[Fact]
public void CanGetDefaultName()
{
var folder = TestData.Get(@"TestData");
using (var fs = new DisposableFileSystem())
{
var baseFolder = fs.GetFolder();
var intermediateFolder = Path.Combine(baseFolder, "obj");
var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
var result = WixRunner.Execute(new[]
{
"build",
Path.Combine(folder, "Directory", "DefaultName.wxs"),
Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
"-bindpath", Path.Combine(folder, "SingleFile", "data"),
"-intermediateFolder", intermediateFolder,
"-o", msiPath
});
result.AssertSuccess();
var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
var section = intermediate.Sections.Single();
var dirSymbols = section.Symbols.OfType<WixToolset.Data.Symbols.DirectorySymbol>().ToList();
WixAssert.CompareLineByLine(new[]
{
"BinFolder\tCompanyFolder\t.",
"CompanyFolder\tProgramFilesFolder\tExample Corporation",
"ProgramFilesFolder\tTARGETDIR\tPFiles",
"TARGETDIR\t\tSourceDir"
}, dirSymbols.OrderBy(d => d.Id.Id).Select(d => String.Join('\t', d.Id.Id, d.ParentDirectoryRef, d.Name)).ToArray());
var data = WindowsInstallerData.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
var directoryRows = data.Tables["Directory"].Rows;
WixAssert.CompareLineByLine(new[]
{
"BinFolder\tCompanyFolder\t.",
"CompanyFolder\tProgramFilesFolder\tu7-b4gch|Example Corporation",
"ProgramFilesFolder\tTARGETDIR\tPFiles",
"TARGETDIR\t\tSourceDir"
}, directoryRows.Select(r => String.Join('\t', r.FieldAsString(0), r.FieldAsString(1), r.FieldAsString(2))).ToArray());
}
}
[Fact]
public void CanGetDuplicateDir()
{

Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="BinFolder" />
</Fragment>
<Fragment>
<StandardDirectory Id="ProgramFilesFolder">
<Directory Id="CompanyFolder" Name="!(bind.Property.Manufacturer)">
<Directory Id="BinFolder" Name="." />
</Directory>
</StandardDirectory>
</Fragment>
</Wix>