diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs | 411 |
1 files changed, 0 insertions, 411 deletions
diff --git a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs deleted file mode 100644 index 61efad47..00000000 --- a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs +++ /dev/null | |||
@@ -1,411 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Sdk | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Linq; | ||
8 | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
9 | using WixInternal.MSTestSupport; | ||
10 | using WixInternal.Core.MSTestPackage; | ||
11 | using WixToolset.Data; | ||
12 | using WixToolset.Data.Symbols; | ||
13 | |||
14 | [TestClass] | ||
15 | public class MsbuildHeatFixture | ||
16 | { | ||
17 | public static readonly string HeatTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildHeatFixture).Assembly.CodeBase).LocalPath), "..", "..", "..", "publish", "WixToolset.Heat", "build", "WixToolset.Heat.targets"); | ||
18 | |||
19 | public MsbuildHeatFixture() | ||
20 | { | ||
21 | EnsureWixSdkCached(); | ||
22 | } | ||
23 | |||
24 | [TestMethod] | ||
25 | [DataRow(BuildSystem.DotNetCoreSdk)] | ||
26 | [DataRow(BuildSystem.MSBuild)] | ||
27 | [DataRow(BuildSystem.MSBuild64)] | ||
28 | public void CanBuildHeatFilePackage(BuildSystem buildSystem) | ||
29 | { | ||
30 | var sourceFolder = TestData.Get("TestData", "HeatFilePackage"); | ||
31 | |||
32 | using (var fs = new DisposableFileSystem()) | ||
33 | { | ||
34 | var baseFolder = fs.GetFolder(); | ||
35 | var binFolder = Path.Combine(baseFolder, @"bin"); | ||
36 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
37 | var projectPath = Path.Combine(sourceFolder, "HeatFilePackage.wixproj"); | ||
38 | |||
39 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { | ||
40 | "-Restore", | ||
41 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "HeatTargetsPath", MsbuildHeatFixture.HeatTargetsPath), | ||
42 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "BaseIntermediateOutputPath", intermediateFolder), | ||
43 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "OutputPath", binFolder), | ||
44 | }); | ||
45 | result.AssertSuccess(); | ||
46 | |||
47 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); | ||
48 | WixAssert.Single(heatCommandLines); | ||
49 | |||
50 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | ||
51 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); | ||
52 | |||
53 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); | ||
54 | var generatedContents = File.ReadAllText(generatedFilePath); | ||
55 | var testXml = generatedContents.GetTestXml(); | ||
56 | WixAssert.StringEqual(@"<Wix>" + | ||
57 | "<Fragment>" + | ||
58 | "<DirectoryRef Id='INSTALLFOLDER'>" + | ||
59 | "<Component Id='HeatFilePackage.wixproj' Guid='*'>" + | ||
60 | "<File Id='HeatFilePackage.wixproj' KeyPath='yes' Source='SourceDir\\HeatFilePackage.wixproj' />" + | ||
61 | "</Component>" + | ||
62 | "</DirectoryRef>" + | ||
63 | "</Fragment>" + | ||
64 | "<Fragment>" + | ||
65 | "<ComponentGroup Id='ProductComponents'>" + | ||
66 | "<ComponentRef Id='HeatFilePackage.wixproj' />" + | ||
67 | "</ComponentGroup>" + | ||
68 | "</Fragment>" + | ||
69 | "</Wix>", testXml); | ||
70 | |||
71 | var pdbPath = Path.Combine(binFolder, "HeatFilePackage.wixpdb"); | ||
72 | var intermediate = Intermediate.Load(pdbPath); | ||
73 | var section = intermediate.Sections.Single(); | ||
74 | |||
75 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | ||
76 | WixAssert.StringEqual(@"SourceDir\HeatFilePackage.wixproj", fileSymbol[FileSymbolFields.Source].PreviousValue.AsPath()?.Path); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | [TestMethod] | ||
81 | [DataRow(BuildSystem.DotNetCoreSdk)] | ||
82 | [DataRow(BuildSystem.MSBuild)] | ||
83 | [DataRow(BuildSystem.MSBuild64)] | ||
84 | public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem) | ||
85 | { | ||
86 | var sourceFolder = TestData.Get(@"TestData", "HeatFileMultipleFilesSameFileName"); | ||
87 | |||
88 | using (var fs = new DisposableFileSystem()) | ||
89 | { | ||
90 | var baseFolder = fs.GetFolder(); | ||
91 | var binFolder = Path.Combine(baseFolder, @"bin\"); | ||
92 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
93 | var projectPath = Path.Combine(sourceFolder, "HeatFileMultipleFilesSameFileName.wixproj"); | ||
94 | |||
95 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { | ||
96 | "-Restore", | ||
97 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "HeatTargetsPath", MsbuildHeatFixture.HeatTargetsPath), | ||
98 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "BaseIntermediateOutputPath", intermediateFolder), | ||
99 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "OutputPath", binFolder), | ||
100 | }); | ||
101 | result.AssertSuccess(); | ||
102 | |||
103 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); | ||
104 | Assert.AreEqual(2, heatCommandLines.Count()); | ||
105 | |||
106 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | ||
107 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); | ||
108 | |||
109 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); | ||
110 | Assert.IsTrue(File.Exists(generatedFilePath)); | ||
111 | |||
112 | var generatedContents = File.ReadAllText(generatedFilePath); | ||
113 | var testXml = generatedContents.GetTestXml(); | ||
114 | WixAssert.StringEqual("<Wix>" + | ||
115 | "<Fragment>" + | ||
116 | "<DirectoryRef Id='INSTALLFOLDER'>" + | ||
117 | "<Component Id='MyProgram.txt' Guid='*'>" + | ||
118 | @"<File Id='MyProgram.txt' KeyPath='yes' Source='SourceDir\MyProgram.txt' />" + | ||
119 | "</Component>" + | ||
120 | "</DirectoryRef>" + | ||
121 | "</Fragment>" + | ||
122 | "<Fragment>" + | ||
123 | "<ComponentGroup Id='TxtProductComponents'>" + | ||
124 | "<ComponentRef Id='MyProgram.txt' />" + | ||
125 | "</ComponentGroup>" + | ||
126 | "</Fragment>" + | ||
127 | "</Wix>", testXml); | ||
128 | |||
129 | generatedFilePath = Path.Combine(intermediateFolder, "Release", "_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); | ||
130 | Assert.IsTrue(File.Exists(generatedFilePath)); | ||
131 | |||
132 | generatedContents = File.ReadAllText(generatedFilePath); | ||
133 | testXml = generatedContents.GetTestXml(); | ||
134 | WixAssert.StringEqual("<Wix>" + | ||
135 | "<Fragment>" + | ||
136 | "<DirectoryRef Id='INSTALLFOLDER'>" + | ||
137 | "<Component Id='MyProgram.json' Guid='*'>" + | ||
138 | @"<File Id='MyProgram.json' KeyPath='yes' Source='SourceDir\MyProgram.json' />" + | ||
139 | "</Component>" + | ||
140 | "</DirectoryRef>" + | ||
141 | "</Fragment>" + | ||
142 | "<Fragment>" + | ||
143 | "<ComponentGroup Id='JsonProductComponents'>" + | ||
144 | "<ComponentRef Id='MyProgram.json' />" + | ||
145 | "</ComponentGroup>" + | ||
146 | "</Fragment>" + | ||
147 | "</Wix>", testXml); | ||
148 | |||
149 | var pdbPath = Path.Combine(binFolder, "HeatFileMultipleFilesSameFileName.wixpdb"); | ||
150 | Assert.IsTrue(File.Exists(pdbPath)); | ||
151 | |||
152 | var intermediate = Intermediate.Load(pdbPath); | ||
153 | var section = intermediate.Sections.Single(); | ||
154 | |||
155 | var fileSymbols = section.Symbols.OfType<FileSymbol>().ToArray(); | ||
156 | WixAssert.StringEqual(@"SourceDir\MyProgram.txt", fileSymbols[0][FileSymbolFields.Source].PreviousValue.AsPath()?.Path); | ||
157 | WixAssert.StringEqual(@"SourceDir\MyProgram.json", fileSymbols[1][FileSymbolFields.Source].PreviousValue.AsPath()?.Path); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | [TestMethod] | ||
162 | [DataRow(BuildSystem.DotNetCoreSdk, true)] | ||
163 | [DataRow(BuildSystem.DotNetCoreSdk, false)] | ||
164 | [DataRow(BuildSystem.MSBuild, true)] | ||
165 | [DataRow(BuildSystem.MSBuild, false)] | ||
166 | [DataRow(BuildSystem.MSBuild64, true)] | ||
167 | [DataRow(BuildSystem.MSBuild64, false)] | ||
168 | public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useToolsVersion) | ||
169 | { | ||
170 | var sourceFolder = TestData.Get(@"TestData", "HeatProject"); | ||
171 | |||
172 | using (var fs = new TestDataFolderFileSystem()) | ||
173 | { | ||
174 | fs.Initialize(sourceFolder); | ||
175 | File.Copy("global.json", Path.Combine(fs.BaseFolder, "global.json")); | ||
176 | |||
177 | var baseFolder = Path.Combine(fs.BaseFolder, "HeatProjectPreSdkStyle"); | ||
178 | var binFolder = Path.Combine(baseFolder, @"bin\"); | ||
179 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
180 | var projectPath = Path.Combine(baseFolder, "HeatProjectPreSdkStyle.wixproj"); | ||
181 | |||
182 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | ||
183 | { | ||
184 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "HeatTargetsPath", MsbuildHeatFixture.HeatTargetsPath), | ||
185 | useToolsVersion ? $"-p:HarvestProjectsUseToolsVersion=true" : String.Empty, | ||
186 | }); | ||
187 | result.AssertSuccess(); | ||
188 | |||
189 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); | ||
190 | var heatCommandLine = WixAssert.Single(heatCommandLines); | ||
191 | |||
192 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | ||
193 | { | ||
194 | Assert.IsTrue(heatCommandLine.Contains("-usetoolsversion")); | ||
195 | } | ||
196 | else | ||
197 | { | ||
198 | Assert.IsFalse(heatCommandLine.Contains("-usetoolsversion")); | ||
199 | } | ||
200 | |||
201 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | ||
202 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); | ||
203 | |||
204 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_Tools Version 4Cs.wxs"); | ||
205 | Assert.IsTrue(File.Exists(generatedFilePath)); | ||
206 | |||
207 | var generatedContents = File.ReadAllText(generatedFilePath); | ||
208 | var testXml = generatedContents.GetTestXml(); | ||
209 | WixAssert.StringEqual(@"<Wix>" + | ||
210 | "<Fragment>" + | ||
211 | "<DirectoryRef Id='Tools_Version_4Cs.Binaries'>" + | ||
212 | "<Component Id='Tools_Version_4Cs.Binaries.Tools_Version_4Cs.dll' Guid='*'>" + | ||
213 | "<File Id='Tools_Version_4Cs.Binaries.Tools_Version_4Cs.dll' Source='$(var.Tools_Version_4Cs.TargetDir)\\Tools Version 4Cs.dll' />" + | ||
214 | "</Component>" + | ||
215 | "</DirectoryRef>" + | ||
216 | "</Fragment>" + | ||
217 | "<Fragment>" + | ||
218 | "<ComponentGroup Id='Tools_Version_4Cs.Binaries'>" + | ||
219 | "<ComponentRef Id='Tools_Version_4Cs.Binaries.Tools_Version_4Cs.dll' />" + | ||
220 | "</ComponentGroup>" + | ||
221 | "</Fragment>" + | ||
222 | "<Fragment>" + | ||
223 | "<DirectoryRef Id='Tools_Version_4Cs.Symbols'>" + | ||
224 | "<Component Id='Tools_Version_4Cs.Symbols.Tools_Version_4Cs.pdb' Guid='*'>" + | ||
225 | "<File Id='Tools_Version_4Cs.Symbols.Tools_Version_4Cs.pdb' Source='$(var.Tools_Version_4Cs.TargetDir)\\Tools Version 4Cs.pdb' />" + | ||
226 | "</Component>" + | ||
227 | "</DirectoryRef>" + | ||
228 | "</Fragment>" + | ||
229 | "<Fragment>" + | ||
230 | "<ComponentGroup Id='Tools_Version_4Cs.Symbols'>" + | ||
231 | "<ComponentRef Id='Tools_Version_4Cs.Symbols.Tools_Version_4Cs.pdb' />" + | ||
232 | "</ComponentGroup>" + | ||
233 | "</Fragment>" + | ||
234 | "<Fragment>" + | ||
235 | "<DirectoryRef Id='Tools_Version_4Cs.Sources'>" + | ||
236 | "<Component Id='Tools_Version_4Cs.Sources.Tools_Version_4Cs.csproj' Guid='*'>" + | ||
237 | "<File Id='Tools_Version_4Cs.Sources.Tools_Version_4Cs.csproj' Source='$(var.Tools_Version_4Cs.ProjectDir)\\Tools Version 4Cs.csproj' />" + | ||
238 | "</Component>" + | ||
239 | "<Directory Id='Tools_Version_4Cs.Sources.Properties' Name='Properties'>" + | ||
240 | "<Component Id='Tools_Version_4Cs.Sources.AssemblyInfo.cs' Guid='*'>" + | ||
241 | "<File Id='Tools_Version_4Cs.Sources.AssemblyInfo.cs' Source='$(var.Tools_Version_4Cs.ProjectDir)\\Properties\\AssemblyInfo.cs' />" + | ||
242 | "</Component>" + | ||
243 | "</Directory>" + | ||
244 | "</DirectoryRef>" + | ||
245 | "</Fragment>" + | ||
246 | "<Fragment>" + | ||
247 | "<ComponentGroup Id='Tools_Version_4Cs.Sources'>" + | ||
248 | "<ComponentRef Id='Tools_Version_4Cs.Sources.Tools_Version_4Cs.csproj' />" + | ||
249 | "<ComponentRef Id='Tools_Version_4Cs.Sources.AssemblyInfo.cs' />" + | ||
250 | "</ComponentGroup>" + | ||
251 | "</Fragment>" + | ||
252 | "<Fragment>" + | ||
253 | "<ComponentGroup Id='Tools_Version_4Cs.Content' />" + | ||
254 | "</Fragment>" + | ||
255 | "<Fragment>" + | ||
256 | "<ComponentGroup Id='Tools_Version_4Cs.Satellites' />" + | ||
257 | "</Fragment>" + | ||
258 | "<Fragment>" + | ||
259 | "<ComponentGroup Id='Tools_Version_4Cs.Documents' />" + | ||
260 | "</Fragment>" + | ||
261 | "</Wix>", testXml); | ||
262 | |||
263 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectPreSdkStyle.wixpdb"); | ||
264 | Assert.IsTrue(File.Exists(pdbPath)); | ||
265 | |||
266 | var intermediate = Intermediate.Load(pdbPath); | ||
267 | var section = intermediate.Sections.Single(); | ||
268 | |||
269 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | ||
270 | WixAssert.StringEqual(Path.Combine(fs.BaseFolder, "Tools Version 4Cs", "bin", "Release\\\\Tools Version 4Cs.dll"), fileSymbol[FileSymbolFields.Source].AsPath()?.Path); | ||
271 | } | ||
272 | } | ||
273 | |||
274 | [TestMethod] | ||
275 | [DataRow(BuildSystem.DotNetCoreSdk, true)] | ||
276 | [DataRow(BuildSystem.DotNetCoreSdk, false)] | ||
277 | [DataRow(BuildSystem.MSBuild, true)] | ||
278 | [DataRow(BuildSystem.MSBuild, false)] | ||
279 | [DataRow(BuildSystem.MSBuild64, true)] | ||
280 | [DataRow(BuildSystem.MSBuild64, false)] | ||
281 | public void CanBuildHeatProjectSdkStyle(BuildSystem buildSystem, bool useToolsVersion) | ||
282 | { | ||
283 | var sourceFolder = TestData.Get(@"TestData\HeatProject"); | ||
284 | |||
285 | using (var fs = new TestDataFolderFileSystem()) | ||
286 | { | ||
287 | fs.Initialize(sourceFolder); | ||
288 | File.Copy("global.json", Path.Combine(fs.BaseFolder, "global.json")); | ||
289 | |||
290 | var baseFolder = Path.Combine(fs.BaseFolder, "HeatProjectSdkStyle"); | ||
291 | var binFolder = Path.Combine(baseFolder, @"bin\"); | ||
292 | var intermediateFolder = Path.Combine(baseFolder, @"obj\"); | ||
293 | var projectPath = Path.Combine(fs.BaseFolder, "HeatProjectSdkStyle", "HeatProjectSdkStyle.wixproj"); | ||
294 | var referencedProjectPath = Path.Combine(fs.BaseFolder, "SdkStyleCs", "SdkStyleCs.csproj"); | ||
295 | |||
296 | var result = MsbuildUtilities.BuildProject(buildSystem, referencedProjectPath, new[] | ||
297 | { | ||
298 | "-t:restore", | ||
299 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "HeatTargetsPath", MsbuildHeatFixture.HeatTargetsPath), | ||
300 | }); | ||
301 | result.AssertSuccess(); | ||
302 | |||
303 | result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | ||
304 | { | ||
305 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "HeatTargetsPath", MsbuildHeatFixture.HeatTargetsPath), | ||
306 | useToolsVersion ? $"-p:HarvestProjectsUseToolsVersion=true" : String.Empty, | ||
307 | }); | ||
308 | result.AssertSuccess(); | ||
309 | |||
310 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); | ||
311 | var heatCommandLine = WixAssert.Single(heatCommandLines); | ||
312 | |||
313 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | ||
314 | { | ||
315 | Assert.IsTrue(heatCommandLine.Contains("-usetoolsversion")); | ||
316 | } | ||
317 | else | ||
318 | { | ||
319 | Assert.IsFalse(heatCommandLine.Contains("-usetoolsversion")); | ||
320 | } | ||
321 | |||
322 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | ||
323 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); | ||
324 | |||
325 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_SdkStyleCs.wxs"); | ||
326 | Assert.IsTrue(File.Exists(generatedFilePath)); | ||
327 | |||
328 | var generatedContents = File.ReadAllText(generatedFilePath); | ||
329 | var testXml = generatedContents.GetTestXml(); | ||
330 | WixAssert.StringEqual(@"<Wix>" + | ||
331 | "<Fragment>" + | ||
332 | "<DirectoryRef Id='SdkStyleCs.Binaries'>" + | ||
333 | "<Component Id='SdkStyleCs.Binaries.SdkStyleCs.dll' Guid='*'>" + | ||
334 | "<File Id='SdkStyleCs.Binaries.SdkStyleCs.dll' Source='$(var.SdkStyleCs.TargetDir)\\SdkStyleCs.dll' />" + | ||
335 | "</Component>" + | ||
336 | "</DirectoryRef>" + | ||
337 | "</Fragment>" + | ||
338 | "<Fragment>" + | ||
339 | "<ComponentGroup Id='SdkStyleCs.Binaries'>" + | ||
340 | "<ComponentRef Id='SdkStyleCs.Binaries.SdkStyleCs.dll' />" + | ||
341 | "</ComponentGroup>" + | ||
342 | "</Fragment>" + | ||
343 | "<Fragment>" + | ||
344 | "<DirectoryRef Id='SdkStyleCs.Symbols'>" + | ||
345 | "<Component Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' Guid='*'>" + | ||
346 | "<File Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' Source='$(var.SdkStyleCs.TargetDir)\\SdkStyleCs.pdb' />" + | ||
347 | "</Component>" + | ||
348 | "</DirectoryRef>" + | ||
349 | "</Fragment>" + | ||
350 | "<Fragment>" + | ||
351 | "<ComponentGroup Id='SdkStyleCs.Symbols'>" + | ||
352 | "<ComponentRef Id='SdkStyleCs.Symbols.SdkStyleCs.pdb' />" + | ||
353 | "</ComponentGroup>" + | ||
354 | "</Fragment>" + | ||
355 | "<Fragment>" + | ||
356 | "<DirectoryRef Id='SdkStyleCs.Sources'>" + | ||
357 | "<Component Id='SdkStyleCs.Sources.SdkStyleCs.cs' Guid='*'>" + | ||
358 | "<File Id='SdkStyleCs.Sources.SdkStyleCs.cs' Source='$(var.SdkStyleCs.ProjectDir)\\SdkStyleCs.cs' />" + | ||
359 | "</Component>" + | ||
360 | "<Component Id='SdkStyleCs.Sources.SdkStyleCs.csproj' Guid='*'>" + | ||
361 | "<File Id='SdkStyleCs.Sources.SdkStyleCs.csproj' Source='$(var.SdkStyleCs.ProjectDir)\\SdkStyleCs.csproj' />" + | ||
362 | "</Component>" + | ||
363 | "</DirectoryRef>" + | ||
364 | "</Fragment>" + | ||
365 | "<Fragment>" + | ||
366 | "<ComponentGroup Id='SdkStyleCs.Sources'>" + | ||
367 | "<ComponentRef Id='SdkStyleCs.Sources.SdkStyleCs.cs' />" + | ||
368 | "<ComponentRef Id='SdkStyleCs.Sources.SdkStyleCs.csproj' />" + | ||
369 | "</ComponentGroup>" + | ||
370 | "</Fragment>" + | ||
371 | "<Fragment>" + | ||
372 | "<ComponentGroup Id='SdkStyleCs.Content' />" + | ||
373 | "</Fragment>" + | ||
374 | "<Fragment>" + | ||
375 | "<ComponentGroup Id='SdkStyleCs.Satellites' />" + | ||
376 | "</Fragment>" + | ||
377 | "<Fragment>" + | ||
378 | "<ComponentGroup Id='SdkStyleCs.Documents' />" + | ||
379 | "</Fragment>" + | ||
380 | "</Wix>", testXml); | ||
381 | |||
382 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectSdkStyle.wixpdb"); | ||
383 | Assert.IsTrue(File.Exists(pdbPath)); | ||
384 | |||
385 | var intermediate = Intermediate.Load(pdbPath); | ||
386 | var section = intermediate.Sections.Single(); | ||
387 | |||
388 | var fileSymbol = section.Symbols.OfType<FileSymbol>().Single(); | ||
389 | WixAssert.StringEqual(Path.Combine(fs.BaseFolder, "SdkStyleCs", "bin", "Release", "netstandard2.0\\\\SdkStyleCs.dll"), fileSymbol[FileSymbolFields.Source].AsPath()?.Path); | ||
390 | } | ||
391 | } | ||
392 | |||
393 | /// <summary> | ||
394 | /// This method exists to get the WixToolset.Sdk.nupkg into the NuGet package cache using the global.json | ||
395 | /// and nuget.config in the root of the repository. By pre-caching the WiX SDK, the rest of the tests will | ||
396 | /// pull the binaries out of the cache instead of needing to find the original .nupkg in the build artifacts | ||
397 | /// folder (which requires use of nuget.config found in the root of the repo) | ||
398 | /// </summary> | ||
399 | private static void EnsureWixSdkCached() | ||
400 | { | ||
401 | // This EnsureWixSdkCached project exists only to pre-cache the WixToolset.Sdk for use by later projects. | ||
402 | var sourceFolder = TestData.Get("TestData", "EnsureWixSdkCached"); | ||
403 | |||
404 | var result = MsbuildUtilities.BuildProject(BuildSystem.DotNetCoreSdk, Path.Combine(sourceFolder, "EnsureWixSdkCached.wixproj"), new[] | ||
405 | { | ||
406 | "-t:restore", | ||
407 | }); | ||
408 | result.AssertSuccess(); | ||
409 | } | ||
410 | } | ||
411 | } | ||