forked from dotnet/msbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolutionFile_Tests.cs
2359 lines (2142 loc) · 133 KB
/
SolutionFile_Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Microsoft.Build.Construction;
using Microsoft.Build.Exceptions;
using Microsoft.Build.Shared;
using Shouldly;
using Xunit;
using Xunit.Abstractions;
#nullable disable
namespace Microsoft.Build.UnitTests.Construction
{
public class SolutionFile_Tests
{
public ITestOutputHelper TestOutputHelper { get; }
public SolutionFile_Tests(ITestOutputHelper testOutputHelper)
{
TestOutputHelper = testOutputHelper;
}
/// <summary>
/// Test just the most basic, plain vanilla first project line.
/// </summary>
[Fact]
public void BasicParseFirstProjectLine()
{
SolutionFile p = new SolutionFile();
p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{Project GUID}\") = \"Project name\", \"Relative path to project file\", \"Unique name-GUID\"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.Unknown);
proj.ProjectName.ShouldBe("Project name");
proj.RelativePath.ShouldBe("Relative path to project file");
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
/// <summary>
/// Test that the first project line of a project with the C++ project guid and an
/// extension of vcproj is seen as invalid.
/// </summary>
[Fact]
[Trait("Category", "netcore-osx-failing")]
[Trait("Category", "netcore-linux-failing")]
public void ParseFirstProjectLine_VC()
{
Should.Throw<InvalidProjectFileException>(() =>
{
SolutionFile p = new SolutionFile();
p.FullPath = "c:\\foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"Project name.vcproj\", \"Relative path\\to\\Project name.vcproj\", \"Unique name-GUID\"",
proj);
});
}
/// <summary>
/// Test that the first project line of a project with the C++ project guid and an
/// arbitrary extension is seen as valid -- we assume that all C++ projects except
/// .vcproj are MSBuild format.
/// </summary>
[Fact]
public void ParseFirstProjectLine_VC2()
{
SolutionFile p = new SolutionFile();
p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"Project name.myvctype\", \"Relative path\\to\\Project name.myvctype\", \"Unique name-GUID\"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.KnownToBeMSBuildFormat);
proj.ProjectName.ShouldBe("Project name.myvctype");
proj.RelativePath.ShouldBe("Relative path\\to\\Project name.myvctype");
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
/// <summary>
/// A slightly more complicated test where there is some different whitespace.
/// </summary>
[Fact]
public void ParseFirstProjectLineWithDifferentSpacing()
{
SolutionFile p = new SolutionFile();
p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\" {Project GUID} \") = \" Project name \", \" Relative path to project file \" , \" Unique name-GUID \"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.Unknown);
proj.ProjectName.ShouldBe("Project name");
proj.RelativePath.ShouldBe("Relative path to project file");
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
/// <summary>
/// First project line with an empty project name. This is somewhat malformed, but we should
/// still behave reasonably instead of crashing.
/// </summary>
[Fact]
public void ParseFirstProjectLine_InvalidProject()
{
SolutionFile p = new SolutionFile();
p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{Project GUID}\") = \"\", \"src\\.proj\", \"Unique name-GUID\"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.Unknown);
proj.ProjectName.ShouldStartWith("EmptyProjectName");
proj.RelativePath.ShouldBe("src\\.proj");
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
/// <summary>
/// Test ParseEtpProject function.
/// </summary>
[Fact]
public void ParseEtpProject()
{
string proj1Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj.etp");
try
{
// Create the first .etp project file
string etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<Views>
<ProjectExplorer>
<File>ClassLibrary2.csproj</File>
</ProjectExplorer>
</Views>
<References>
<Reference>
<FILE>ClassLibrary2.csproj</FILE>
<GUIDPROJECTID>{73D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FE}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
File.WriteAllText(proj1Path, etpProjContent);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
// Project should get added to the solution
solution.ProjectsInOrder[0].RelativePath.ShouldBe(@"someproj.etp");
solution.ProjectsInOrder[1].RelativePath.ShouldBe(@"ClassLibrary2.csproj");
}
// Delete the files created during the test
finally
{
File.Delete(proj1Path);
}
}
/// <summary>
/// Test CanBeMSBuildFile
/// </summary>
[Fact]
public void CanBeMSBuildFile()
{
string proj1Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj.etp");
string proj2Path = Path.Combine(FileUtilities.TempFileDirectory, "someproja.proj");
try
{
// Create the first .etp project file
string etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<Views>
<ProjectExplorer>
<File>ClassLibrary2.csproj</File>
</ProjectExplorer>
</Views>
<References>
<Reference>
<FILE>ClassLibrary2.csproj</FILE>
<GUIDPROJECTID>{73D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FE}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
string genericProj = ObjectModelHelpers.CleanupFileContents(@"
<Project ToolsVersion=""msbuilddefaulttoolsversion"" DefaultTargets=""Build"" xmlns=""msbuildnamespace"">
<ItemGroup>
<Reference Include=""System"" />
<Reference Include=""System.Data"" />
<Reference Include=""System.Xml"" />
</ItemGroup>
<ItemGroup>
<Compile Include=""Class1.cs"" />
<Compile Include=""Properties\AssemblyInfo.cs"" />
</ItemGroup>
<Import Project=""$(MSBuildBinPath)\Microsoft.CSharp.targets"" />
</Project>
");
File.WriteAllText(proj1Path, etpProjContent);
File.WriteAllText(proj2Path, genericProj);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project('{NNNNNNNN-9925-4D57-9DAF-E0A9D936ABDB}') = 'someproja', 'someproja.proj', '{CCCCCCCC-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
ProjectInSolution project = solution.ProjectsByGuid["{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}"];
ProjectInSolution project2 = solution.ProjectsByGuid["{CCCCCCCC-9925-4D57-9DAF-E0A9D936ABDB}"];
project.CanBeMSBuildProjectFile(out _).ShouldBeFalse();
project2.CanBeMSBuildProjectFile(out _).ShouldBeTrue();
}
// Delete the files created during the test
finally
{
File.Delete(proj1Path);
File.Delete(proj2Path);
}
}
/// <summary>
/// Test CanBeMSBuildFile
/// </summary>
[Fact]
public void CanBeMSBuildFileRejectsMSBuildLikeFiles()
{
using (var env = TestEnvironment.Create())
{
string rptprojProjContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Project xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" ToolsVersion=""2.0"">
<DataSources />
<Reports />
</Project>";
string dwprojProjContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Project xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ddl2=""http://schemas.microsoft.com/analysisservices/2003/engine/2"" xmlns:ddl2_2=""http://schemas.microsoft.com/analysisservices/2003/engine/2/2"" xmlns:ddl100_100=""http://schemas.microsoft.com/analysisservices/2008/engine/100/100"" xmlns:ddl200=""http://schemas.microsoft.com/analysisservices/2010/engine/200"" xmlns:ddl200_200=""http://schemas.microsoft.com/analysisservices/2010/engine/200/200"" xmlns:dwd=""http://schemas.microsoft.com/DataWarehouse/Designer/1.0"">
<ProductVersion />
<SchemaVersion />
<State />
<Database />
<Cubes />
</Project>";
string rptprojPath = env.CreateFile(".rptproj").Path;
File.WriteAllText(rptprojPath, rptprojProjContent);
string dqprojPath = env.CreateFile(".dwproj").Path;
File.WriteAllText(dqprojPath, dwprojProjContent);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{F14B399A-7131-4C87-9E4B-1186C45EF12D}') = 'RptProj', '" + Path.GetFileName(rptprojPath) + @"', '{CCCCCCCC-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project('{D2ABAB84-BF74-430A-B69E-9DC6D40DDA17}') = 'DwProj', '" + Path.GetFileName(dqprojPath) + @"', '{DEA89696-F42B-4B58-B7EE-017FF40817D1}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
ProjectInSolution project1 = solution.ProjectsByGuid["{CCCCCCCC-9925-4D57-9DAF-E0A9D936ABDB}"];
ProjectInSolution project2 = solution.ProjectsByGuid["{DEA89696-F42B-4B58-B7EE-017FF40817D1}"];
project1.CanBeMSBuildProjectFile(out _).ShouldBe(false);
project2.CanBeMSBuildProjectFile(out _).ShouldBe(false);
}
}
/// <summary>
/// Test ParseEtpProject function.
/// </summary>
[Fact]
public void ParseNestedEtpProjectSingleLevel()
{
string proj1Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj.etp");
string proj2Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj2.etp");
try
{
// Create the first .etp project file
string etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<References>
<Reference>
<FILE>someproj2.etp</FILE>
<GUIDPROJECTID>{73D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FE}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
File.WriteAllText(proj1Path, etpProjContent);
// Create the second .etp project file
etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<References>
<Reference>
<FILE>ClassLibrary1.csproj</FILE>
<GUIDPROJECTID>{83D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FF}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
File.WriteAllText(proj2Path, etpProjContent);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
// Project should get added to the solution
solution.ProjectsInOrder[0].RelativePath.ShouldBe(@"someproj.etp");
solution.ProjectsInOrder[1].RelativePath.ShouldBe(@"someproj2.etp");
solution.ProjectsInOrder[2].RelativePath.ShouldBe(@"ClassLibrary1.csproj");
}
// Delete the files created during the test
finally
{
File.Delete(proj1Path);
File.Delete(proj2Path);
}
}
[Fact]
public void TestVSAndSolutionVersionParsing()
{
// Create the SolutionFile object
string solutionFileContentsPriorToDev12 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionPriorToDev12 = ParseSolutionHelper(solutionFileContentsPriorToDev12);
solutionPriorToDev12.Version.ShouldBe(11);
solutionPriorToDev12.VisualStudioVersion.ShouldBe(10);
// Create the SolutionFile object
string solutionFileContentsDev12 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = 12.0.20311.0 VSPRO_PLATFORM
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12 = ParseSolutionHelper(solutionFileContentsDev12);
solutionDev12.Version.ShouldBe(11);
solutionDev12.VisualStudioVersion.ShouldBe(12);
// Test parsing of corrupted VisualStudioVersion lines
// Version number deleted
string solutionFileContentsDev12Corrupted1 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = VSPRO_PLATFORM
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted1 = ParseSolutionHelper(solutionFileContentsDev12Corrupted1);
solutionDev12Corrupted1.Version.ShouldBe(11);
solutionDev12Corrupted1.VisualStudioVersion.ShouldBe(10);
// Remove version number and VSPRO_PLATFORM tag
string solutionFileContentsDev12Corrupted2 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion =
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted2 = ParseSolutionHelper(solutionFileContentsDev12Corrupted2);
solutionDev12Corrupted2.Version.ShouldBe(11);
solutionDev12Corrupted2.VisualStudioVersion.ShouldBe(10);
// Switch positions between VSPRO_PLATFORM tag and version number
string solutionFileContentsDev12Corrupted3 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = VSPRO_PLATFORM 12.0.20311.0
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted3 = ParseSolutionHelper(solutionFileContentsDev12Corrupted3);
solutionDev12Corrupted3.Version.ShouldBe(11);
solutionDev12Corrupted3.VisualStudioVersion.ShouldBe(10);
// Add a number of spaces before version number and glue it together with VSPRO_PLATFORM
string solutionFileContentsDev12Corrupted4 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = 12.0.20311.0VSPRO_PLATFORM
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted4 = ParseSolutionHelper(solutionFileContentsDev12Corrupted4);
solutionDev12Corrupted4.Version.ShouldBe(11);
solutionDev12Corrupted4.VisualStudioVersion.ShouldBe(10);
// Corrupted version number
string solutionFileContentsDev12Corrupted5 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = ...12..0,.20311.0 VSPRO_PLATFORM
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted5 = ParseSolutionHelper(solutionFileContentsDev12Corrupted5);
solutionDev12Corrupted5.Version.ShouldBe(11);
solutionDev12Corrupted5.VisualStudioVersion.ShouldBe(10);
// Add a number of spaces before version number
string solutionFileContentsDev12Corrupted6 =
@"
Microsoft Visual Studio Solution File, Format Version 11.00
VisualStudioVersion = 12.0.20311.0 VSPRO_PLATFORM
MinimumVisualStudioVersion = 10.0.40219.1
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solutionDev12Corrupted6 = ParseSolutionHelper(solutionFileContentsDev12Corrupted6);
solutionDev12Corrupted6.Version.ShouldBe(11);
solutionDev12Corrupted6.VisualStudioVersion.ShouldBe(12);
}
/// <summary>
/// Test ParseEtpProject function.
/// </summary>
[Fact]
[Trait("Category", "netcore-osx-failing")]
[Trait("Category", "netcore-linux-failing")]
public void ParseNestedEtpProjectMultipleLevel()
{
string proj1Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj.etp");
string proj2Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj2.etp");
string proj3Path = Path.Combine(FileUtilities.TempFileDirectory, "ETPProjUpgradeTest", "someproj3.etp");
try
{
// Create the first .etp project file
string etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<References>
<Reference>
<FILE>someproj2.etp</FILE>
<GUIDPROJECTID>{73D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FE}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
File.WriteAllText(proj1Path, etpProjContent);
// Create the second .etp project file
etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<References>
<Reference>
<FILE>ETPProjUpgradeTest\someproj3.etp</FILE>
<GUIDPROJECTID>{83D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FF}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
File.WriteAllText(proj2Path, etpProjContent);
// Create the third .etp project file
etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<References>
<Reference>
<FILE>" + Path.Combine("..", "SomeFolder", "ClassLibrary1.csproj") + @"</FILE>
<GUIDPROJECTID>{83D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FF}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
</EFPROJECT>";
// Create the directory for the third project
Directory.CreateDirectory(Path.Combine(FileUtilities.TempFileDirectory, "ETPProjUpgradeTest"));
File.WriteAllText(proj3Path, etpProjContent);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
// Project should get added to the solution
solution.ProjectsInOrder[0].RelativePath.ShouldBe(@"someproj.etp");
solution.ProjectsInOrder[1].RelativePath.ShouldBe(@"someproj2.etp");
solution.ProjectsInOrder[2].RelativePath.ShouldBe(@"ETPProjUpgradeTest\someproj3.etp");
solution.ProjectsInOrder[3].RelativePath.ShouldBe(Path.Combine("ETPProjUpgradeTest", "..", "SomeFolder", "ClassLibrary1.csproj"));
}
// Delete the files created during the test
finally
{
File.Delete(proj1Path);
File.Delete(proj2Path);
File.Delete(proj3Path);
}
}
/// <summary>
/// Ensure that a malformed .etp proj file listed in the .SLN file results in an
/// InvalidProjectFileException.
/// </summary>
[Fact]
public void MalformedEtpProjFile()
{
string proj1Path = Path.Combine(FileUtilities.TempFileDirectory, "someproj.etp");
try
{
// Create the .etp project file
// Note the </EFPROJECT> is missing
string etpProjContent = @"<?xml version=""1.0""?>
<EFPROJECT>
<GENERAL>
<BANNER>Microsoft Visual Studio Application Template File</BANNER>
<VERSION>1.00</VERSION>
<Views>
<ProjectExplorer>
<File>ClassLibrary2\ClassLibrary2.csproj</File>
</ProjectExplorer>
</Views>
<References>
<Reference>
<FILE>ClassLibrary2\ClassLibrary2.csproj</FILE>
<GUIDPROJECTID>{73D0F4CE-D9D3-4E8B-81E4-B26FBF4CC2FE}</GUIDPROJECTID>
</Reference>
</References>
</GENERAL>
";
File.WriteAllText(proj1Path, etpProjContent);
// Create the SolutionFile object
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
string errCode;
ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out errCode, out _, "Shared.InvalidProjectFile",
"someproj.etp", String.Empty);
foreach (string warningString in solution.SolutionParserWarnings)
{
TestOutputHelper.WriteLine(warningString);
}
solution.SolutionParserErrorCodes[0].ShouldContain(errCode);
}
// Delete the files created during the test
finally
{
File.Delete(proj1Path);
}
}
/// <summary>
/// Ensure that a missing .etp proj file listed in the .SLN file results in an
/// InvalidProjectFileException.
/// </summary>
[Fact]
public void MissingEtpProjFile()
{
string proj1Path = Path.Combine(Path.GetTempPath(), "someproj.etp");
// Create the solution file
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 8.00
Project('{FE3BBBB6-72D5-11D2-9ACE-00C04F79A2A4}') = 'someproj', 'someproj.etp', '{AD0F3D02-9925-4D57-9DAF-E0A9D936ABDB}'
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject";
// Delete the someproj.etp file if it exists
File.Delete(proj1Path);
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
string errCode;
ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out errCode, out _, "Shared.ProjectFileCouldNotBeLoaded",
"someproj.etp", String.Empty);
solution.SolutionParserErrorCodes[0].ShouldContain(errCode);
}
/// <summary>
/// Test some characters that are valid in a file name but that also could be
/// considered a delimiter by a parser. Does quoting work for special characters?
/// </summary>
[Fact]
public void ParseFirstProjectLineWhereProjectNameHasSpecialCharacters()
{
SolutionFile p = new SolutionFile();
p.FullPath = NativeMethodsShared.IsWindows ? "c:\\foo.sln" : "/foo.sln";
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{Project GUID}\") = \"MyProject,(=IsGreat)\", \"Relative path to project file\" , \"Unique name-GUID\"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.Unknown);
proj.ProjectName.ShouldBe("MyProject,(=IsGreat)");
proj.RelativePath.ShouldBe("Relative path to project file");
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
/// <summary>
/// Test some characters that are valid in a file name but that also could be
/// considered a delimiter by a parser. Does quoting work for special characters?
/// </summary>
[Fact]
public void ParseFirstProjectLineWhereProjectPathHasBackslash()
{
using (var env = TestEnvironment.Create())
{
var solutionFolder = env.CreateFolder(Path.Combine(FileUtilities.GetTemporaryDirectory(), "sln"));
env.CreateFolder(Path.Combine(solutionFolder.Path, "RelativePath"));
SolutionFile p = new SolutionFile();
p.FullPath = Path.Combine(solutionFolder.Path, "RelativePath", "project file");
p.SolutionFileDirectory = Path.GetFullPath(solutionFolder.Path);
ProjectInSolution proj = new ProjectInSolution(p);
p.ParseFirstProjectLine(
"Project(\"{Project GUID}\") = \"ProjectInSubdirectory\", \"RelativePath\\project file\" , \"Unique name-GUID\"",
proj);
proj.ProjectType.ShouldBe(SolutionProjectType.Unknown);
proj.ProjectName.ShouldBe("ProjectInSubdirectory");
proj.RelativePath.ShouldBe(Path.Combine("RelativePath", "project file"));
proj.ProjectGuid.ShouldBe("Unique name-GUID");
}
}
/// <summary>
/// Helper method to create a SolutionFile object, and call it to parse the SLN file
/// represented by the string contents passed in.
/// </summary>
/// <param name="solutionFileContents"></param>
/// <returns></returns>
internal static SolutionFile ParseSolutionHelper(string solutionFileContents)
{
solutionFileContents = solutionFileContents.Replace('\'', '"');
StreamReader sr = StreamHelpers.StringToStreamReader(solutionFileContents);
SolutionFile sp = new SolutionFile();
sp.SolutionFileDirectory = Path.GetTempPath();
sp.SolutionReader = sr;
sp.FullPath = FileUtilities.GetTemporaryFileName(".sln");
sp.ParseSolution();
// Clean up the temporary file that got created with this call
return sp;
}
/// <summary>
/// Ensure that a bogus version stamp in the .SLN file results in an
/// InvalidProjectFileException.
/// </summary>
[Fact]
public void BadVersionStamp()
{
Should.Throw<InvalidProjectFileException>(() =>
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version a.b
# Visual Studio 2005
";
ParseSolutionHelper(solutionFileContents);
});
}
/// <summary>
/// Expected version numbers less than 7 to cause an invalid project file exception.
/// </summary>
[Fact]
public void VersionTooLow()
{
Should.Throw<InvalidProjectFileException>(() =>
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 6.0
# Visual Studio 2005
";
ParseSolutionHelper(solutionFileContents);
});
}
/// <summary>
/// Ensure that an unsupported version greater than the current maximum (10) in the .SLN file results in a
/// comment indicating we will try and continue
/// </summary>
[Fact]
public void UnsupportedVersion()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 999.0
# Visual Studio 2005
";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
solution.SolutionParserComments.ShouldHaveSingleItem(); // "Expected the solution parser to contain one comment"
solution.SolutionParserComments[0].ShouldBe(ResourceUtilities.FormatResourceStringStripCodeAndKeyword("UnrecognizedSolutionComment", "999"));
}
[Fact]
public void Version9()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 9.0
# Visual Studio 2005
";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
solution.Version.ShouldBe(9);
}
[Fact]
public void Version10()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 10.0
# Visual Studio 2005
";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
solution.Version.ShouldBe(10);
}
/// <summary>
/// Test to parse a very basic .sln file to validate that description property in a solution file
/// is properly handled.
/// </summary>
[Fact]
public void ParseSolutionFileWithDescriptionInformation()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'AnyProject', 'AnyProject\AnyProject.csproj', '{2CAB0FBD-15D8-458B-8E63-1B5B840E9798}'
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Description = Some description of this solution
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2CAB0FBD-15D8-458B-8E63-1B5B840E9798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CAB0FBD-15D8-458B-8E63-1B5B840E9798}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CAB0FBD-15D8-458B-8E63-1B5B840E9798}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CAB0FBD-15D8-458B-8E63-1B5B840E9798}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
";
try
{
ParseSolutionHelper(solutionFileContents);
}
catch (Exception ex)
{
throw new Exception("Failed to parse solution containing description information. Error: " + ex.Message, ex);
}
}
/// <summary>
/// Tests the parsing of a very basic .SLN file with four independent projects.
/// </summary>
[Fact]
public void BasicSolution()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project('{F184B08F-C81C-45F6-A57F-5ABD9991F28F}') = 'ConsoleApplication1', 'ConsoleApplication1\ConsoleApplication1.vbproj', '{AB3413A6-D689-486D-B7F0-A095371B3F13}'
EndProject
Project('{F184B08F-C81C-45F6-A57F-5ABD9991F28F}') = 'vbClassLibrary', 'vbClassLibrary\vbClassLibrary.vbproj', '{BA333A76-4511-47B8-8DF4-CA51C303AD0B}'
EndProject
Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'ClassLibrary1', 'ClassLibrary1\ClassLibrary1.csproj', '{DEBCE986-61B9-435E-8018-44B9EF751655}'
EndProject
Project('{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}') = 'cpsFsProject', 'cpsFsProject\ProjectFileName.fsproj', '{9200923E-1814-4E76-A677-C61E4896D67F}'
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AnyCPU = Debug|AnyCPU
Release|AnyCPU = Release|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB3413A6-D689-486D-B7F0-A095371B3F13}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU
{AB3413A6-D689-486D-B7F0-A095371B3F13}.Debug|AnyCPU.Build.0 = Debug|AnyCPU
{AB3413A6-D689-486D-B7F0-A095371B3F13}.Release|AnyCPU.ActiveCfg = Release|AnyCPU
{AB3413A6-D689-486D-B7F0-A095371B3F13}.Release|AnyCPU.Build.0 = Release|AnyCPU
{BA333A76-4511-47B8-8DF4-CA51C303AD0B}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU
{BA333A76-4511-47B8-8DF4-CA51C303AD0B}.Debug|AnyCPU.Build.0 = Debug|AnyCPU
{BA333A76-4511-47B8-8DF4-CA51C303AD0B}.Release|AnyCPU.ActiveCfg = Release|AnyCPU
{BA333A76-4511-47B8-8DF4-CA51C303AD0B}.Release|AnyCPU.Build.0 = Release|AnyCPU
{DEBCE986-61B9-435E-8018-44B9EF751655}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU
{DEBCE986-61B9-435E-8018-44B9EF751655}.Debug|AnyCPU.Build.0 = Debug|AnyCPU
{DEBCE986-61B9-435E-8018-44B9EF751655}.Release|AnyCPU.ActiveCfg = Release|AnyCPU
{DEBCE986-61B9-435E-8018-44B9EF751655}.Release|AnyCPU.Build.0 = Release|AnyCPU
{9200923E-1814-4E76-A677-C61E4896D67F}.Debug|AnyCPU.ActiveCfg = Debug|AnyCPU
{9200923E-1814-4E76-A677-C61E4896D67F}.Debug|AnyCPU.Build.0 = Debug|AnyCPU
{9200923E-1814-4E76-A677-C61E4896D67F}.Release|AnyCPU.ActiveCfg = Release|AnyCPU
{9200923E-1814-4E76-A677-C61E4896D67F}.Release|AnyCPU.Build.0 = Release|AnyCPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
solution.ProjectsInOrder.Count.ShouldBe(4);
solution.ProjectsInOrder[0].ProjectType.ShouldBe(SolutionProjectType.KnownToBeMSBuildFormat);
solution.ProjectsInOrder[0].ProjectName.ShouldBe("ConsoleApplication1");
solution.ProjectsInOrder[0].RelativePath.ShouldBe(@"ConsoleApplication1\ConsoleApplication1.vbproj");
solution.ProjectsInOrder[0].ProjectGuid.ShouldBe("{AB3413A6-D689-486D-B7F0-A095371B3F13}");
solution.ProjectsInOrder[0].Dependencies.ShouldBeEmpty();
solution.ProjectsInOrder[0].ParentProjectGuid.ShouldBeNull();
solution.ProjectsInOrder[0].GetUniqueProjectName().ShouldBe("ConsoleApplication1");
solution.ProjectsInOrder[1].ProjectType.ShouldBe(SolutionProjectType.KnownToBeMSBuildFormat);
solution.ProjectsInOrder[1].ProjectName.ShouldBe("vbClassLibrary");
solution.ProjectsInOrder[1].RelativePath.ShouldBe(@"vbClassLibrary\vbClassLibrary.vbproj");
solution.ProjectsInOrder[1].ProjectGuid.ShouldBe("{BA333A76-4511-47B8-8DF4-CA51C303AD0B}");
solution.ProjectsInOrder[1].Dependencies.ShouldBeEmpty();
solution.ProjectsInOrder[1].ParentProjectGuid.ShouldBeNull();
solution.ProjectsInOrder[1].GetUniqueProjectName().ShouldBe("vbClassLibrary");
solution.ProjectsInOrder[2].ProjectType.ShouldBe(SolutionProjectType.KnownToBeMSBuildFormat);
solution.ProjectsInOrder[2].ProjectName.ShouldBe("ClassLibrary1");
solution.ProjectsInOrder[2].RelativePath.ShouldBe(@"ClassLibrary1\ClassLibrary1.csproj");
solution.ProjectsInOrder[2].ProjectGuid.ShouldBe("{DEBCE986-61B9-435E-8018-44B9EF751655}");
solution.ProjectsInOrder[2].Dependencies.ShouldBeEmpty();
solution.ProjectsInOrder[2].ParentProjectGuid.ShouldBeNull();
solution.ProjectsInOrder[2].GetUniqueProjectName().ShouldBe("ClassLibrary1");
solution.ProjectsInOrder[3].ProjectType.ShouldBe(SolutionProjectType.KnownToBeMSBuildFormat);
solution.ProjectsInOrder[3].ProjectName.ShouldBe("cpsFsProject");
solution.ProjectsInOrder[3].RelativePath.ShouldBe(@"cpsFsProject\ProjectFileName.fsproj");
solution.ProjectsInOrder[3].ProjectGuid.ShouldBe("{9200923E-1814-4E76-A677-C61E4896D67F}");
solution.ProjectsInOrder[3].Dependencies.ShouldBeEmpty();
solution.ProjectsInOrder[3].ParentProjectGuid.ShouldBeNull();
solution.ProjectsInOrder[3].GetUniqueProjectName().ShouldBe("cpsFsProject");
}
/// <summary>
/// Exercises solution folders, and makes sure that samely named projects in different
/// solution folders will get correctly uniquified.
/// </summary>
[Fact]
public void SolutionFolders()
{
string solutionFileContents =
@"
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'ClassLibrary1', 'ClassLibrary1\ClassLibrary1.csproj', '{34E0D07D-CF8F-459D-9449-C4188D8C5564}'
EndProject
Project('{2150E333-8FDC-42A3-9474-1A3956D46DE8}') = 'MySlnFolder', 'MySlnFolder', '{E0F97730-25D2-418A-A7BD-02CAFDC6E470}'
EndProject
Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'ClassLibrary1', 'MyPhysicalFolder\ClassLibrary1\ClassLibrary1.csproj', '{A5EE8128-B08E-4533-86C5-E46714981680}'
EndProject
Project('{2150E333-8FDC-42A3-9474-1A3956D46DE8}') = 'MySubSlnFolder', 'MySubSlnFolder', '{2AE8D6C4-FB43-430C-8AEB-15E5EEDAAE4B}'
EndProject
Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'ClassLibrary2', 'ClassLibrary2\ClassLibrary2.csproj', '{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4}'
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{34E0D07D-CF8F-459D-9449-C4188D8C5564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34E0D07D-CF8F-459D-9449-C4188D8C5564}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34E0D07D-CF8F-459D-9449-C4188D8C5564}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34E0D07D-CF8F-459D-9449-C4188D8C5564}.Release|Any CPU.Build.0 = Release|Any CPU
{A5EE8128-B08E-4533-86C5-E46714981680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5EE8128-B08E-4533-86C5-E46714981680}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5EE8128-B08E-4533-86C5-E46714981680}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5EE8128-B08E-4533-86C5-E46714981680}.Release|Any CPU.Build.0 = Release|Any CPU
{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A5EE8128-B08E-4533-86C5-E46714981680} = {E0F97730-25D2-418A-A7BD-02CAFDC6E470}
{2AE8D6C4-FB43-430C-8AEB-15E5EEDAAE4B} = {E0F97730-25D2-418A-A7BD-02CAFDC6E470}
{6DB98C35-FDCC-4818-B5D4-1F0A385FDFD4} = {2AE8D6C4-FB43-430C-8AEB-15E5EEDAAE4B}
EndGlobalSection
EndGlobal
";
SolutionFile solution = ParseSolutionHelper(solutionFileContents);
solution.ProjectsInOrder.Count.ShouldBe(5);
solution.ProjectsInOrder[0].RelativePath.ShouldBe(@"ClassLibrary1\ClassLibrary1.csproj");
solution.ProjectsInOrder[0].ProjectGuid.ShouldBe("{34E0D07D-CF8F-459D-9449-C4188D8C5564}");
solution.ProjectsInOrder[0].Dependencies.ShouldBeEmpty();
solution.ProjectsInOrder[0].ParentProjectGuid.ShouldBeNull();