Partial WixPdbs stop the backend before binding.
Bob Arnson committed
Mar 17, 2020 at 21:28 UTC
fe77cae987ea2bfc43d2ffec660bf773e922709d
4 files changed
+81
-6
src/WixToolset.BuildTasks/DoIt.cs
+5
-1
@@ -47,7 +47,9 @@ namespace WixToolset.BuildTasks
47
48
public string OutputType { get; set; }
49
50
- public string PdbOutputFile { get; set; }
50
+ public ITaskItem PdbFile { get; set; }
51
+
52
+ public string PdbType { get; set; }
53
54
public bool Pedantic { get; set; }
55
@@ -162,6 +164,8 @@ namespace WixToolset.BuildTasks
164
commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.InstallerPlatform);
165
commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
166
commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType);
167
+ commandLineBuilder.AppendSwitchIfNotNull("-pdb ", this.PdbFile);
168
+ commandLineBuilder.AppendSwitchIfNotNull("-pdbType ", this.PdbType);
169
commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
170
commandLineBuilder.AppendArrayIfNotNull("-culture ", this.Cultures);
171
commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants);
src/WixToolset.BuildTasks/wix.targets
+11
-2
@@ -54,8 +54,11 @@
54
<OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName>
55
<AssemblyName>$(OutputName)</AssemblyName>
56
57
- <!-- Default the OutputType to a known WiX Toolset type. -->
57
+ <!-- Default OutputType to a known WiX Toolset type. -->
58
<OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
59
+
60
+ <!-- Default WixPdbType to a known WiX Toolset type. -->
61
+ <WixPdbType Condition=" '$(WixPdbType)' == '' ">full</WixPdbType>
62
</PropertyGroup>
63
64
<!--
@@ -228,6 +231,11 @@
231
Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' < '4.0' "
232
Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project "$(MSBuildProjectFile)". You must use MSBuild v4.0 or later." />
233
234
+ <Error
235
+ Code="WIX103"
236
+ Condition=" '$(WixPdbType)' != 'none' and '$(WixPdbType)' != 'full' and '$(WixPdbType)' != 'partial' "
237
+ Text="The WixPdbType property '$(WixPdbType)' is not valid in project "$(MSBuildProjectFile)". Supported values are: 'full', 'none', 'partial'" />
238
+
239
</Target>
240
241
<!--
@@ -636,7 +644,8 @@
644
645
OutputFile="$(OutputFile)"
646
OutputType="$(OutputType)"
639
- PdbOutputFile="$(PdbOutputFile)"
647
+ PdbFile="$(PdbOutputFile)"
648
+ PdbType="$(WixPdbType)"
649
650
AdditionalOptions="$(CompilerAdditionalOptions) $(LinkerAdditionalOptions)"
651
DefineConstants="$(DefineConstants);$(SolutionDefineConstants);$(ProjectDefineConstants);$(ProjectReferenceDefineConstants)"
src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
+60
@@ -51,6 +51,66 @@ namespace WixToolsetTest.BuildTasks
51
}
52
}
53
54
+ [Fact]
55
+ public void CanBuildWithDefaultAndExplicitlyFullWixpdbs()
56
+ {
57
+ var expectedOutputs = new[]
58
+ {
59
+ @"bin\en-US\cab1.cab",
60
+ @"bin\en-US\MsiPackage.msi",
61
+ @"bin\en-US\MsiPackage.wixpdb",
62
+ };
63
+
64
+ this.AssertWixpdb(null, expectedOutputs);
65
+ this.AssertWixpdb("Full", expectedOutputs);
66
+ }
67
+
68
+ [Fact]
69
+ public void CanBuildWithPartialWixpdb()
70
+ {
71
+ this.AssertWixpdb("partial", new[]
72
+ {
73
+ @"bin\en-US\MsiPackage.wixpdb",
74
+ });
75
+ }
76
+
77
+ [Fact]
78
+ public void CanBuildWithNoWixpdb()
79
+ {
80
+ this.AssertWixpdb("NONE", new[]
81
+ {
82
+ @"bin\en-US\cab1.cab",
83
+ @"bin\en-US\MsiPackage.msi",
84
+ });
85
+ }
86
+
87
+ private void AssertWixpdb(string wixpdbType, string[] expectedOutputFiles)
88
+ {
89
+ var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj");
90
+
91
+ using (var fs = new DisposableFileSystem())
92
+ {
93
+ var baseFolder = fs.GetFolder();
94
+ var binFolder = Path.Combine(baseFolder, @"bin\");
95
+ var intermediateFolder = Path.Combine(baseFolder, @"obj\");
96
+
97
+ var result = MsbuildRunner.Execute(projectPath, new[]
98
+ {
99
+ wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}",
100
+ $"-p:WixTargetsPath={WixTargetsPath}",
101
+ $"-p:IntermediateOutputPath={intermediateFolder}",
102
+ $"-p:OutputPath={binFolder}",
103
+ });
104
+ result.AssertSuccess();
105
+
106
+ var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories)
107
+ .Select(s => s.Substring(baseFolder.Length + 1))
108
+ .OrderBy(s => s)
109
+ .ToArray();
110
+ Assert.Equal(expectedOutputFiles, paths);
111
+ }
112
+ }
113
+
114
[Fact]
115
public void CanBuild64BitMsiPackage()
116
{
src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs
+5
-3
@@ -22,7 +22,7 @@ namespace WixToolsetTest.BuildTasks
22
{
23
var baseFolder = fs.GetFolder();
24
var intermediateFolder = Path.Combine(baseFolder, "obj");
25
-
25
+ var pdbPath = Path.Combine(baseFolder, @"bin\testpackage.wixpdb");
26
var engine = new FakeBuildEngine();
27
28
var task = new DoIt
@@ -43,16 +43,18 @@ namespace WixToolsetTest.BuildTasks
43
},
44
IntermediateDirectory = new TaskItem(intermediateFolder),
45
OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")),
46
+ PdbType = "Full",
47
+ PdbFile = new TaskItem(pdbPath),
48
};
49
50
var result = task.Execute();
51
Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}");
52
53
Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
52
- Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
54
+ Assert.True(File.Exists(pdbPath));
55
Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab")));
56
55
- var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
57
+ var intermediate = Intermediate.Load(pdbPath);
58
var section = intermediate.Sections.Single();
59
60
var fileTuple = section.Tuples.OfType<FileTuple>().Single();