@joebigelow / wix / commits / 266aed49

Add missing IniFile createLine handling

Fixes 7009

Rob Mensching committed Nov 15, 2022 at 08:11 UTC 266aed497296cdb087eac157c575e95253ed67ca
4 files changed +50
src/wix/WixToolset.Core/Compiler.cs
+3
@@ -5958,6 +5958,9 @@ namespace WixToolset.Core
5958 case "addTag":
5959 action = IniFileActionType.AddTag;
5960 break;
5961 + case "createLine":
5962 + action = IniFileActionType.CreateLine;
5963 + break;
5964 case "removeLine":
5965 action = IniFileActionType.RemoveLine;
5966 break;
src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+33
@@ -528,6 +528,39 @@ namespace WixToolsetTest.CoreIntegration
528 }
529 }
530
531 + [Fact]
532 + public void PopulatesIniFile()
533 + {
534 + var folder = TestData.Get(@"TestData");
535 +
536 + using (var fs = new DisposableFileSystem())
537 + {
538 + var baseFolder = fs.GetFolder();
539 + var intermediateFolder = Path.Combine(baseFolder, "obj");
540 + var msiPath = Path.Combine(baseFolder, @"bin", "test.msi");
541 +
542 + var result = WixRunner.Execute(new[]
543 + {
544 + "build",
545 + Path.Combine(folder, "IniFile", "IniFile.wxs"),
546 + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
547 + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
548 + "-bindpath", Path.Combine(folder, "SingleFile", "data"),
549 + "-intermediateFolder", intermediateFolder,
550 + "-o", msiPath
551 + });
552 +
553 + result.AssertSuccess();
554 +
555 + Assert.True(File.Exists(msiPath));
556 + var results = Query.QueryDatabase(msiPath, new[] { "IniFile" });
557 + WixAssert.CompareLineByLine(new[]
558 + {
559 + "IniFile:iniRVwYTVbDGRcXg7ckoDxDHV1iRaQ\ttest.txt\tINSTALLFOLDER\tTestSection\tSomeKey\tSomeValue\t2\tIniComp",
560 + }, results);
561 + }
562 + }
563 +
564 [Fact]
565 public void PopulatesInstallExecuteSequenceTable()
566 {
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Font/FontTitle.wxs
+2
@@ -4,6 +4,8 @@
4 <ComponentGroup Id="ProductComponents">
5 <Component Id="FontComp" Directory="INSTALLFOLDER">
6 <File Id="test.txt" Source="test.txt" FontTitle="FakeFont" />
7 +
8 + <IniFile Id="SetLicenseKey" Action="createLine" Directory="ConfigurationFolder" Name="filename.conf" Section="Connectivity" Key="License" Value="1234" />
9 </Component>
10 </ComponentGroup>
11 </Fragment>
src/wix/test/WixToolsetTest.CoreIntegration/TestData/IniFile/IniFile.wxs new
+12
@@ -0,0 +1,12 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Fragment>
4 + <ComponentGroup Id="ProductComponents">
5 + <Component Id="IniComp" Directory="INSTALLFOLDER">
6 + <File Id="test.txt" Source="test.txt" />
7 +
8 + <IniFile Action="createLine" Directory="INSTALLFOLDER" Name="test.txt" Section="TestSection" Key="SomeKey" Value="SomeValue" />
9 + </Component>
10 + </ComponentGroup>
11 + </Fragment>
12 +</Wix>