forked from microsoft/vstest
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.ps1
1316 lines (1075 loc) · 74 KB
/
build.ps1
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
# Copyright (c) Microsoft. All rights reserved.
# Build script for Test Platform.
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)]
[ValidateSet("Debug", "Release")]
[Alias("c")]
[System.String] $Configuration = "Debug",
[Parameter(Mandatory = $false)]
[Alias("r")]
[System.String] $TargetRuntime = "win7-x64",
# Versioning scheme = Major(15).Minor(RTW, Updates).SubUpdates(preview4, preview5, RC etc)
# E.g. VS 2017 Update 1 Preview will have version 15.1.1
[Parameter(Mandatory = $false)]
[Alias("v")]
[System.String] $Version, # Will set this later by reading TestPlatform.Settings.targets file.
[Parameter(Mandatory = $false)]
[Alias("vs")]
[System.String] $VersionSuffix = "dev",
[Parameter(Mandatory = $false)]
[Alias("bn")]
[System.String] $BuildNumber = "20991231-99",
[Parameter(Mandatory = $false)]
[Alias("ff")]
[System.Boolean] $FailFast = $true,
[Parameter(Mandatory = $false)]
[Alias("noloc")]
[Switch] $DisableLocalizedBuild,
[Parameter(Mandatory = $false)]
[Alias("ci")]
[Switch] $CIBuild,
[Parameter(Mandatory = $false)]
[Alias("pt")]
[Switch] $PublishTestArtifacts,
# Build specific projects
[Parameter(Mandatory = $false)]
[Alias("p")]
[System.String[]] $ProjectNamePatterns = @(),
[Alias("f")]
[Switch] $Force,
[Alias("s")]
[ValidateSet("InstallDotnet", "Restore", "UpdateLocalization", "Build", "Publish", "Pack", "Manifest", "PrepareAcceptanceTests")]
[String[]] $Steps = @("InstallDotnet", "Restore", "UpdateLocalization", "Build", "Publish", "Pack", "Manifest", "PrepareAcceptanceTests")
)
$ErrorActionPreference = 'Stop'
$ErrorView = 'Normal'
. $PSScriptRoot\common.lib.ps1
# Set Version from scripts/build/TestPlatform.Settings.targets, when we are running locally and not providing the version as the parameter
# or when the build is done directly in VS
if ([string]::IsNullOrWhiteSpace($Version)) {
$Version = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Settings.targets)).Project.PropertyGroup[0].TPVersionPrefix |
ForEach-Object { $_.Trim() } |
Select-Object -First 1
Write-Verbose "Version was not provided using version '$Version' from TestPlatform.Settings.targets"
}
#
# Build configuration
#
Write-Verbose "Setup build configuration."
$TPB_TestAssets = Join-Path $env:TP_ROOT_DIR "test\TestAssets\"
$TPB_Solution = Join-Path $env:TP_ROOT_DIR "TestPlatform.sln"
$TPB_TestAssets_Solution = Join-Path $TPB_TestAssets "TestAssets.sln"
$TPB_TestAssets_CILAssets = Join-Path $TPB_TestAssets "CILProject\CILProject.proj"
$TPB_TargetFramework45 = "net45"
$TPB_TargetFramework451 = "net451"
$TPB_TargetFramework472 = "net472"
$TPB_TargetFramework48 = "net48"
$TPB_TargetFrameworkCore10 = "netcoreapp1.0"
$TPB_TargetFrameworkCore20 = "netcoreapp2.1"
$TPB_TargetFrameworkUap100 = "uap10.0"
$TPB_TargetFrameworkNS10 = "netstandard1.0"
$TPB_TargetFrameworkNS13 = "netstandard1.3"
$TPB_TargetFrameworkNS20 = "netstandard2.0"
$TPB_Configuration = $Configuration
$TPB_TargetRuntime = $TargetRuntime
$TPB_X64_Runtime = "win7-x64"
$TPB_X86_Runtime = "win7-x86"
$TPB_ARM64_Runtime = "win10-arm64"
# Version suffix is empty for RTM release
$TPB_Version = if ($VersionSuffix -ne '') { $Version + "-" + $VersionSuffix } else { $Version }
$TPB_CIBuild = $CIBuild
$TPB_PublishTests = $PublishTestArtifacts
$TPB_LocalizedBuild = !$DisableLocalizedBuild
$TPB_PackageOutDir = Join-Path $env:TP_OUT_DIR $TPB_Configuration\packages
$TPB_SourceBuildPackageOutDir = Join-Path $TPB_PackageOutDir "source-build"
$language = @("cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-Hans", "zh-Hant")
. "$($CurrentScriptDir.FullName)\verify-nupkgs.ps1"
# Update the version in the dependencies props to be the TPB_version version, this is not ideal but because changing how this is resolved would
# mean that we need to change the whole build process this is a solution with the least amount of impact, that does not require us to keep track of
# the version in multiple places
$dependenciesPath = "$env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props"
$dependencies = Get-Content -Raw -Encoding UTF8 $dependenciesPath
$updatedDependencies = $dependencies -replace "<NETTestSdkVersion>.*?</NETTestSdkVersion>", "<NETTestSdkVersion>$TPB_Version</NETTestSdkVersion>"
# PS7 considers utf8 to not have BOM, and utf8BOM needs to be used instead, while earlier versions use BOM with utf8 encoding
$encoding = if ($PSVersionTable.PSVersion.Major -ge 7) { "utf8BOM" } else { "utf8" }
$updatedDependencies | Set-Content -Encoding $encoding $dependenciesPath -NoNewline
$attachVsPath = "$env:TP_ROOT_DIR\src\AttachVS\bin\Debug\net472"
if ($env:PATH -notlike "*$attachVsPath") {
Write-Log "Adding AttachVS to PATH"
$env:PATH = "$attachVsPath;$env:PATH"
}
# VsixUtil gets regularly eaten by antivirus or something. Remove the package dir if it gets broken
# so nuget restores it correctly.
$vsSdkBuildToolsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.VSSdkBuildToolsVersion
$vsixUtilDir = "$env:TP_ROOT_DIR\packages\microsoft.vssdk.buildtools"
if ((Test-Path $vsixUtilDir) -and -not (Test-Path "$vsixUtilDir\$vsSdkBuildToolsVersion\tools\vssdk\bin\VsixUtil.exe")) {
Remove-Item -Recurse -Force $vsixUtilDir
}
# Procdump gets regularly eaten by antivirus or something. Remove the package dir if it gets broken
# so nuget restores it correctly.
$procdumpDir = "$env:TP_ROOT_DIR\packages\procdump"
if ((Test-Path $procdumpDir) -and (Test-Path "$procdumpDir\0.0.1\bin") -and 2 -ne @(Get-Item "$procdumpDir\0.0.1\bin").Length) {
Remove-Item -Recurse -Force $procdumpDir
}
function Invoke-Build {
$timer = Start-Timer
Write-Log "Invoke-Build: Start build."
$dotnetExe = Get-DotNetPath
Write-Log ".. .. Build: Source: $TPB_Solution"
Invoke-Exe $dotnetExe -Arguments "build $TPB_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -bl:""$env:TP_OUT_DIR\log\$Configuration\TestPlatform.binlog"""
Write-Log ".. .. Build: Complete."
Write-Log ".. .. Build: Source: $TPB_TestAssets_CILAssets"
Invoke-Exe $dotnetExe -Arguments "build $TPB_TestAssets_CILAssets --configuration $TPB_Configuration -v:minimal -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -bl:""$env:TP_OUT_DIR\log\$Configuration\CILAssets.binlog"""
Write-Log ".. .. Build: Complete."
Write-Log "Invoke-Build: Complete. {$(Get-ElapsedTime($timer))}"
}
function Invoke-TestAssetsBuild {
$timer = Start-Timer
Write-Log "Invoke-TestAssetsBuild: Start test assets build."
$dotnetExe = Get-DotNetPath
$nugetExe = Join-Path $env:TP_PACKAGES_DIR -ChildPath "Nuget.CommandLine" | Join-Path -ChildPath $env:NUGET_EXE_Version | Join-Path -ChildPath "tools\NuGet.exe"
$nugetConfig = Join-Path $TPB_TestAssets "NuGet.config"
Write-Log ".. .. Build: Source: $TPB_TestAssets_Solution"
try {
Write-Log ".. .. Build: Source: $TPB_TestAssets_Solution -- add NuGet source"
Invoke-Exe -IgnoreExitCode 1 $nugetExe -Arguments "sources add -Name ""locally-built-testplatform-packages"" -Source $env:TP_TESTARTIFACTS\packages\ -ConfigFile ""$nugetConfig"""
Invoke-Exe $dotnetExe -Arguments "build $TPB_TestAssets_Solution --configuration $TPB_Configuration -v:minimal -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -bl:""$env:TP_OUT_DIR\log\$Configuration\TestAssets.binlog"""
# Compatibility matrix build.
$dependenciesPath = "$env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props"
$dependenciesXml = [xml](Get-Content -Raw -Encoding UTF8 $dependenciesPath)
# Restore previous versions of TestPlatform (for vstest.console.exe), and TestPlatform.CLI (for vstest.console.dll).
# These properties are coming from TestPlatform.Dependencies.props.
$vstestConsoleVersionProperties = @(
"VSTestConsoleLatestVersion"
"VSTestConsoleLatestPreviewVersion"
"VSTestConsoleLatestStableVersion"
"VSTestConsoleRecentStableVersion"
"VSTestConsoleMostDownloadedVersion"
"VSTestConsolePreviousStableVersion"
"VSTestConsoleLegacyStableVersion"
)
foreach ($propertyName in $vstestConsoleVersionProperties) {
if ("VSTestConsoleLatestVersion" -eq $propertyName) {
# NETTestSdkVersion has the version of the locally built package.
$vsTestConsoleVersion = $dependenciesXml.Project.PropertyGroup."NETTestSdkVersion"
}
else {
$vsTestConsoleVersion = $dependenciesXml.Project.PropertyGroup.$propertyName
}
# The command line tool does not like the package ranges.
$vsTestConsoleVersion = $vsTestConsoleVersion -replace "(\[|\])"
if (-not $vsTestConsoleVersion) {
throw "VSTestConsoleVersion for $propertyName is empty."
}
# We don't use the results of this build anywhere, we just use them to restore the packages to nuget cache
# because using nuget.exe install errors out in various weird ways.
Invoke-Exe $dotnetExe -Arguments "build $env:TP_ROOT_DIR\test\TestAssets\Tools\Tools.csproj --configuration $TPB_Configuration -v:minimal -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -p:NETTestSdkVersion=$vsTestConsoleVersion"
}
# Build with multiple versions of MSTest. The projects are directly in the root.
# The folder structure in VS is not echoed in the TestAssets directory.
$projects = @(
"$env:TP_ROOT_DIR\test\TestAssets\MSTestProject1\MSTestProject1.csproj"
"$env:TP_ROOT_DIR\test\TestAssets\MSTestProject2\MSTestProject2.csproj"
# Don't use this one, it does not use the variables for mstest and test sdk.
# "$env:TP_ROOT_DIR\test\TestAssets\SimpleTestProject2\SimpleTestProject2.csproj"
)
$msTestVersionProperties = @(
"MSTestFrameworkLatestPreviewVersion"
"MSTestFrameworkLatestStableVersion"
"MSTestFrameworkRecentStableVersion"
"MSTestFrameworkMostDownloadedVersion"
"MSTestFrameworkPreviousStableVersion"
"MSTestFrameworkLegacyStableVersion"
)
foreach ($project in $projects) {
# We use the same version properties for NET.Test.Sdk as for VSTestConsole, for now.
foreach ($sdkPropertyName in $vstestConsoleVersionProperties) {
if ("VSTestConsoleLatestVersion" -eq $sdkPropertyName) {
# NETTestSdkVersion has the version of the locally built package.
$netTestSdkVersion = $dependenciesXml.Project.PropertyGroup."NETTestSdkVersion"
}
else {
$netTestSdkVersion = $dependenciesXml.Project.PropertyGroup.$sdkPropertyName
}
if (-not $netTestSdkVersion) {
throw "NetTestSdkVersion for $sdkPropertyName is empty."
}
$dirNetTestSdkVersion = $netTestSdkVersion -replace "\[|\]"
$dirNetTestSdkPropertyName = $sdkPropertyName -replace "Framework" -replace "Version" -replace "VSTestConsole", "NETTestSdk"
foreach ($propertyName in $msTestVersionProperties) {
$mstestVersion = $dependenciesXml.Project.PropertyGroup.$propertyName
if (-not $mstestVersion) {
throw "MSTestVersion for $propertyName is empty."
}
$dirMSTestVersion = $mstestVersion -replace "\[|\]"
$dirMSTestPropertyName = $propertyName -replace "Framework" -replace "Version"
Invoke-Exe $dotnetExe -Arguments "build $project --configuration $TPB_Configuration -v:minimal -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -p:MSTestFrameworkVersion=$mstestVersion -p:MSTestAdapterVersion=$mstestVersion -p:NETTestSdkVersion=$netTestSdkVersion -p:BaseOutputPath=""bin\$dirNetTestSdkPropertyName-$dirNetTestSdkVersion\$dirMSTestPropertyName-$dirMSTestVersion\\"" -bl:""$env:TP_OUT_DIR\log\$Configuration\perm.binlog"""
}
}
}
# end
}
finally {
Write-Log ".. .. Build: Source: $TPB_TestAssets_Solution -- remove NuGet source"
Invoke-Exe -IgnoreExitCode 1 $nugetExe -Arguments "sources remove -Name ""locally-built-testplatform-packages"" -ConfigFile ""$nugetConfig"""
}
Write-Log ".. .. Build: Complete."
Write-Log "Invoke-TestAssetsBuild: Complete. {$(Get-ElapsedTime($timer))}"
}
function Copy-PackageIntoStaticDirectory {
# packages are published into folder based on configuration, but
# nuget does not understand that, and does not support wildcards in paths
# in order to be able to use the produced packages for acceptance tests we
# need to put them in folder that is not changing it's name based on config
$tpPackagesPath = "$env:TP_OUT_DIR\$TPB_Configuration\packages\"
$tpPackagesDestination = "$env:TP_TESTARTIFACTS"
New-Item -ItemType Directory -Force $tpPackagesDestination | Out-Null
Copy-Item $tpPackagesPath $tpPackagesDestination -Force -Filter *.nupkg -Verbose -Recurse
}
function Publish-PatchedDotnet {
Write-Log "Publish-PatchedDotnet: Copy local dotnet installation to testArtifacts"
$dotnetPath = "$env:TP_TOOLS_DIR\dotnet\"
$dotnetTestArtifactsPath = "$env:TP_TESTARTIFACTS\dotnet\"
if (Test-Path $dotnetTestArtifactsPath) {
Remove-Item -Force -Recurse $dotnetTestArtifactsPath
}
$dotnetTestArtifactsSdkPath = "$env:TP_TESTARTIFACTS\dotnet\sdk\$env:DOTNET_CLI_VERSION\"
Copy-Item $dotnetPath $dotnetTestArtifactsPath -Force -Recurse
Write-Log "Publish-PatchedDotnet: Copy VSTest task artifacts to local dotnet installation to allow `dotnet test` to run with it"
$buildArtifactsPath = "$env:TP_ROOT_DIR\src\Microsoft.TestPlatform.Build\bin\$TPB_Configuration\$TPB_TargetFrameworkNS20\*"
Copy-Item $buildArtifactsPath $dotnetTestArtifactsSdkPath -Force
}
function Publish-Package {
$timer = Start-Timer
Write-Log "Publish-Package: Started."
$fullCLRPackage451Dir = Get-FullCLRPackageDirectory
$fullCLRPackage45Dir = Get-FullCLRPackageDirectory45
$uap100PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkUap100");
$net45PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net45");
$netstandard10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS10");
$netstandard13PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS13");
$netstandard20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS20");
$coreCLR20PackageDir = Get-CoreCLR20PackageDirectory
$coreCLR10PackageDir = Get-CoreCLR10PackageDirectory
$coreCLR20TestHostPackageDir = Get-CoreCLR20TestHostPackageDirectory
$packageProject = Join-Path $env:TP_PACKAGE_PROJ_DIR "package\package.csproj"
$testHostProject = Join-Path $env:TP_ROOT_DIR "src\testhost\testhost.csproj"
$testHostx86Project = Join-Path $env:TP_ROOT_DIR "src\testhost.x86\testhost.x86.csproj"
$testHostarm64Project = Join-Path $env:TP_ROOT_DIR "src\testhost.arm64\testhost.arm64.csproj"
$testhostFullPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFramework451\$TPB_TargetRuntime")
$testhostCore20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20")
$testhostCore20PackageX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X64_Runtime")
$testhostCore20PackageX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X86_Runtime")
$testhostCore20PackageARM64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_ARM64_Runtime")
$testhostCore20PackageTempX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X64_Runtime")
$testhostCore20PackageTempX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X86_Runtime")
$testhostCore20PackageTempARM64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_ARM64_Runtime")
$testhostCore10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10")
$testhostCore10PackageX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_X64_Runtime")
$testhostCore10PackageX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_X86_Runtime")
$testhostCore10PackageARM64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_ARM64_Runtime")
$testhostCore10PackageTempX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_X64_Runtime")
$testhostCore10PackageTempX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_X86_Runtime")
$testhostCore10PackageTempARM64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10\$TPB_ARM64_Runtime")
$testhostUapPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkUap100")
$vstestConsoleProject = Join-Path $env:TP_ROOT_DIR "src\vstest.console\vstest.console.csproj"
$settingsMigratorProject = Join-Path $env:TP_ROOT_DIR "src\SettingsMigrator\SettingsMigrator.csproj"
$dataCollectorProject = Join-Path $env:TP_ROOT_DIR "src\datacollector\datacollector.csproj"
Write-Log "Package: Publish src\package\package\package.csproj"
Publish-PackageInternal $packageProject $TPB_TargetFramework451 $fullCLRPackage451Dir
Publish-PackageInternal $packageProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir
################################################################################
# Publish vstest.console and datacollector exclusively because *.config/*.deps.json file is not getting publish when we are publishing aforementioned project through dependency.
Write-Log "Package: Publish src\vstest.console\vstest.console.csproj"
# We build vstest.console.arm64.exe before building vstest.console.exe and we put it in the same folder, so they end up shipping together.
Publish-PackageWithRuntimeInternal $vstestConsoleProject $TPB_TargetFramework451 $TPB_ARM64_Runtime false $fullCLRPackage451Dir
Publish-PackageWithRuntimeInternal $vstestConsoleProject $TPB_TargetFramework451 $TPB_X64_Runtime false $fullCLRPackage451Dir
Publish-PackageInternal $vstestConsoleProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir
Write-Log "Package: Publish src\SettingsMigrator\SettingsMigrator.csproj"
Publish-PackageInternal $settingsMigratorProject $TPB_TargetFramework451 $fullCLRPackage451Dir
Write-Log "Package: Publish src\datacollector\datacollector.csproj"
# We build datacollector.arm64.exe before building datacollector.exe and we put it in the same folder, so they end up shipping together.
Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_ARM64_Runtime false $fullCLRPackage451Dir
Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_X64_Runtime false $fullCLRPackage451Dir
Publish-PackageInternal $dataCollectorProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir
################################################################################
# Publish testhost
Write-Log "Package: Publish testhost\testhost.csproj"
Publish-PackageInternal $testHostProject $TPB_TargetFramework451 $testhostFullPackageDir
Publish-PackageInternal $testHostProject $TPB_TargetFrameworkCore20 $testhostCore20PackageDir
Publish-PackageInternal $testHostProject $TPB_TargetFrameworkCore10 $testhostCore10PackageDir
Publish-PackageInternal $testHostProject $TPB_TargetFrameworkCore20 $testhostUapPackageDir
Publish-PackageWithRuntimeInternal $testHostProject $TPB_TargetFrameworkCore20 $TPB_X64_Runtime false $testhostCore20PackageTempX64Dir
Publish-PackageWithRuntimeInternal $testHostProject $TPB_TargetFrameworkCore10 $TPB_X64_Runtime true $testhostCore10PackageTempX64Dir
Write-Log "Package: Publish testhost.x86\testhost.x86.csproj"
Publish-PackageInternal $testHostx86Project $TPB_TargetFramework451 $testhostFullPackageDir
Publish-PackageWithRuntimeInternal $testHostx86Project $TPB_TargetFrameworkCore20 $TPB_X86_Runtime false $testhostCore20PackageTempX86Dir
Publish-PackageWithRuntimeInternal $testHostx86Project $TPB_TargetFrameworkCore10 $TPB_X86_Runtime true $testhostCore10PackageTempX86Dir
Write-Log "Package: Publish testhost.arm64\testhost.arm64.csproj"
Publish-PackageInternal $testHostarm64Project $TPB_TargetFramework451 $testhostFullPackageDir
Publish-PackageWithRuntimeInternal $testHostarm64Project $TPB_TargetFrameworkCore20 $TPB_ARM64_Runtime false $testhostCore20PackageTempARM64Dir
Publish-PackageWithRuntimeInternal $testHostarm64Project $TPB_TargetFrameworkCore10 $TPB_ARM64_Runtime true $testhostCore10PackageTempARM64Dir
# Copy the .NET multitarget testhost exes to destination folder (except for net451 which is the default)
foreach ($tfm in "net452;net46;net461;net462;net47;net471;net472;net48" -split ";") {
Copy-Item "$(Split-Path $testHostProject)\bin\$TPB_Configuration\$tfm\$TPB_X64_Runtime\testhost.$tfm.exe" $testhostFullPackageDir\testhost.$tfm.exe -Force
Copy-Item "$(Split-Path $testHostProject)\bin\$TPB_Configuration\$tfm\$TPB_X64_Runtime\testhost.$tfm.pdb" $testhostFullPackageDir\testhost.$tfm.pdb -Force
Copy-Item "$(Split-Path $testHostProject)\bin\$TPB_Configuration\$tfm\$TPB_X64_Runtime\testhost.$tfm.exe.config" $testhostFullPackageDir\testhost.$tfm.exe.config -Force
}
# Copy the .NET multitarget testhost.x86 exes to destination folder (except for net451 which is the default)
foreach ($tfm in "net452;net46;net461;net462;net47;net471;net472;net48" -split ";") {
Copy-Item "$(Split-Path $testHostx86Project)\bin\$TPB_Configuration\$tfm\$TPB_X86_Runtime\testhost.$tfm.x86.exe" $testhostFullPackageDir\testhost.$tfm.x86.exe -Force
Copy-Item "$(Split-Path $testHostx86Project)\bin\$TPB_Configuration\$tfm\$TPB_X86_Runtime\testhost.$tfm.x86.pdb" $testhostFullPackageDir\testhost.$tfm.x86.pdb -Force
Copy-Item "$(Split-Path $testHostx86Project)\bin\$TPB_Configuration\$tfm\$TPB_X86_Runtime\testhost.$tfm.x86.exe.config" $testhostFullPackageDir\testhost.$tfm.x86.exe.config -Force
}
# Copy the .NET multitarget testhost.arm64 exes to destination folder (except for net451 which is the default)
foreach ($tfm in "net452;net46;net461;net462;net47;net471;net472;net48" -split ";") {
Copy-Item "$(Split-Path $testHostarm64Project)\bin\$TPB_Configuration\$tfm\$TPB_ARM64_Runtime\testhost.$tfm.arm64.exe" $testhostFullPackageDir\testhost.$tfm.arm64.exe -Force
Copy-Item "$(Split-Path $testHostarm64Project)\bin\$TPB_Configuration\$tfm\$TPB_ARM64_Runtime\testhost.$tfm.arm64.pdb" $testhostFullPackageDir\testhost.$tfm.arm64.pdb -Force
Copy-Item "$(Split-Path $testHostarm64Project)\bin\$TPB_Configuration\$tfm\$TPB_ARM64_Runtime\testhost.$tfm.arm64.exe.config" $testhostFullPackageDir\testhost.$tfm.arm64.exe.config -Force
}
# Copy the .NET core x86, x64 and arm64 testhost exes from tempPublish to required folder
New-Item -ItemType directory -Path $testhostCore20PackageX64Dir -Force | Out-Null
Copy-Item $testhostCore20PackageTempX64Dir\testhost* $testhostCore20PackageX64Dir -Force -Recurse
Copy-Item $testhostCore20PackageTempX64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore20PackageX64Dir -Force
New-Item -ItemType directory -Path $testhostCore20PackageX86Dir -Force | Out-Null
Copy-Item $testhostCore20PackageTempX86Dir\testhost.x86* $testhostCore20PackageX86Dir -Force -Recurse
Copy-Item $testhostCore20PackageTempX86Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore20PackageX86Dir -Force
New-Item -ItemType directory -Path $testhostCore20PackageARM64Dir -Force | Out-Null
Copy-Item $testhostCore20PackageTempARM64Dir\testhost.arm64* $testhostCore20PackageARM64Dir -Force -Recurse
Copy-Item $testhostCore20PackageTempARM64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore20PackageARM64Dir -Force
New-Item -ItemType directory -Path $testhostCore10PackageX64Dir -Force | Out-Null
Copy-Item $testhostCore10PackageTempX64Dir\testhost* $testhostCore10PackageX64Dir -Force -Recurse
Copy-Item $testhostCore20PackageTempX64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore10PackageX64Dir -Force
New-Item -ItemType directory -Path $testhostCore10PackageX86Dir -Force | Out-Null
Copy-Item $testhostCore10PackageTempX86Dir\testhost.x86* $testhostCore10PackageX86Dir -Force -Recurse
Copy-Item $testhostCore10PackageTempX86Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore10PackageX86Dir -Force
New-Item -ItemType directory -Path $testhostCore10PackageARM64Dir -Force | Out-Null
Copy-Item $testhostCore10PackageTempARM64Dir\testhost.arm64* $testhostCore10PackageARM64Dir -Force -Recurse
Copy-Item $testhostCore10PackageTempARM64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore10PackageARM64Dir -Force
# Copy over the Full CLR built testhost package assemblies to the Core CLR and Full CLR package folder.
$coreCLRFull_Dir = "TestHost"
$fullDestDir = Join-Path $coreCLR20PackageDir $coreCLRFull_Dir
New-Item -ItemType directory -Path $fullDestDir -Force | Out-Null
Copy-Item $testhostFullPackageDir\* $fullDestDir -Force -Recurse
# Copy over the Full CLR built datacollector package assemblies to the Core CLR package folder along with testhost
Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_ARM64_Runtime false $fullDestDir
Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_X64_Runtime false $fullDestDir
New-Item -ItemType directory -Path $fullCLRPackage451Dir -Force | Out-Null
Copy-Item $testhostFullPackageDir\* $fullCLRPackage451Dir -Force -Recurse
################################################################################
# Publish Microsoft.TestPlatform.ObjectModel
# Copy this first because for ObjectModel it puts platform abstractions NS1.3 version
# into the output folder (for some reason), and we overwrite it with actual uap10.0 version below
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.ObjectModel\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFramework45 = $fullCLRPackage45Dir # net45
$TPB_TargetFramework451 = $fullCLRPackage451Dir # net451
$TPB_TargetFrameworkCore10 = $coreCLR10PackageDir # netcoreapp1.0
$TPB_TargetFrameworkCore20 = $coreCLR20PackageDir # netcoreapp2.1
$TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0
$TPB_TargetFrameworkNS13 = $netstandard13PackageDir # netstandard1_3
$TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0
$TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0
}
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.ObjectModel\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFrameworkUap100 = $testhostUapPackageDir # uap10.0 - testhost
}
################################################################################
# Publish Microsoft.TestPlatform.PlatformAbstractions
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.PlatformAbstractions\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFramework45 = $fullCLRPackage45Dir # net45
$TPB_TargetFramework451 = $fullCLRPackage451Dir # net451
$TPB_TargetFrameworkCore20 = $coreCLR20PackageDir # netcoreapp2.1
$TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0
$TPB_TargetFrameworkNS13 = $netstandard13PackageDir # netstandard1_3
$TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0
$TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0
}
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.PlatformAbstractions\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFrameworkUap100 = $testhostUapPackageDir # uap10.0 - testhost
}
################################################################################
# Publish Microsoft.TestPlatform.CoreUtilities
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CoreUtilities\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFramework45 = $fullCLRPackage45Dir # net45
$TPB_TargetFramework451 = $fullCLRPackage451Dir # net451
$TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0
$TPB_TargetFrameworkNS13 = $netstandard13PackageDir # netstandard1_3
$TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0
$TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0
}
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CoreUtilities\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFrameworkUap100 = $testhostUapPackageDir # uap10.0 - testhost
}
################################################################################
# Publish Microsoft.TestPlatform.AdapterUtilities
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.AdapterUtilities\bin\$TPB_Configuration") `
-files @{
# "net20" = $net20PackageDir # net20
"net45/any" = $net45PackageDir # $net4
$TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0
$TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0
$TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0
}
################################################################################
# Publish Microsoft.TestPlatform.CrossPlatEngine
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CrossPlatEngine\bin\$TPB_Configuration") `
-files @{
$TPB_TargetFrameworkNS13 = $netstandard13PackageDir # netstandard1_3
}
################################################################################
# Publish msdia
$testPlatformMsDiaVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.TestPlatformMSDiaVersion
$comComponentsDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia\$testPlatformMsDiaVersion\tools\net451"
Copy-Item -Recurse $comComponentsDirectory\* $testhostCore20PackageDir -Force
Copy-Item -Recurse $comComponentsDirectory\* $testhostCore10PackageDir -Force
Copy-Item -Recurse $comComponentsDirectory\* $testhostFullPackageDir -Force
Copy-Item -Recurse $comComponentsDirectory\* $testhostUapPackageDir -Force
Copy-Item -Recurse $comComponentsDirectory\* $coreCLR20TestHostPackageDir -Force
$microsoftInternalDiaInterop = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia.Interop\$testPlatformMsDiaVersion\tools\net451"
Copy-Item -Recurse $microsoftInternalDiaInterop\* $coreCLR20TestHostPackageDir -Force
# Copy over the logger assemblies to the Extensions folder.
$extensions_Dir = "Extensions"
$fullCLRExtensionsDir = Join-Path $fullCLRPackage451Dir $extensions_Dir
$coreCLRExtensionsDir = Join-Path $coreCLR20PackageDir $extensions_Dir
# Create an extensions directory.
New-Item -ItemType directory -Path $fullCLRExtensionsDir -Force | Out-Null
New-Item -ItemType directory -Path $coreCLRExtensionsDir -Force | Out-Null
# If there are some dependencies for the logger assemblies, those need to be moved too.
# Ideally we should just be publishing the loggers to the Extensions folder.
$loggers = @(
"Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.pdb",
"Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.pdb"
)
foreach ($file in $loggers) {
Write-Verbose "Move-Item $fullCLRPackage451Dir\$file $fullCLRExtensionsDir -Force"
Move-Item $fullCLRPackage451Dir\$file $fullCLRExtensionsDir -Force
Write-Verbose "Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force"
Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force
}
# Move logger resource dlls
if ($TPB_LocalizedBuild) {
Move-Loc-Files $fullCLRPackage451Dir $fullCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.resources.dll"
Move-Loc-Files $coreCLR20PackageDir $coreCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.resources.dll"
Move-Loc-Files $fullCLRPackage451Dir $fullCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.resources.dll"
Move-Loc-Files $coreCLR20PackageDir $coreCLRExtensionsDir "Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.resources.dll"
}
# Copy Blame Datacollector to Extensions folder.
$TPB_TargetFrameworkStandard = "netstandard2.0"
$blameDataCollector = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.Extensions.BlameDataCollector\bin\$TPB_Configuration"
$blameDataCollectorNetFull = Join-Path $blameDataCollector $TPB_TargetFramework472
$blameDataCollectorNetStandard = Join-Path $blameDataCollector $TPB_TargetFrameworkStandard
New-Item -ItemType Directory "$fullCLRExtensionsDir/dump" -Force | Out-Null
Copy-Item $blameDataCollectorNetFull\Microsoft.TestPlatform.Extensions.BlameDataCollector.dll $fullCLRExtensionsDir -Force
Copy-Item $blameDataCollectorNetFull\Microsoft.TestPlatform.Extensions.BlameDataCollector.pdb $fullCLRExtensionsDir -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.exe "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.pdb "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.exe.config "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.x86.exe "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.x86.pdb "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.x86.exe.config "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.arm64.exe "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.arm64.pdb "$fullCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetFull\DumpMinitool.arm64.exe.config "$fullCLRExtensionsDir/dump" -Force
New-Item -ItemType Directory "$coreCLRExtensionsDir/dump" -Force | Out-Null
Copy-Item $blameDataCollectorNetStandard\Microsoft.TestPlatform.Extensions.BlameDataCollector.dll $coreCLRExtensionsDir -Force
Copy-Item $blameDataCollectorNetStandard\Microsoft.TestPlatform.Extensions.BlameDataCollector.pdb $coreCLRExtensionsDir -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.exe "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.pdb "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.exe.config "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.x86.exe "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.x86.pdb "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.x86.exe.config "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.arm64.exe "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.arm64.pdb "$coreCLRExtensionsDir/dump" -Force
Copy-Item $blameDataCollectorNetStandard\DumpMinitool.arm64.exe.config "$coreCLRExtensionsDir/dump" -Force
# we use this to dump processes on netcore
Copy-Item $blameDataCollectorNetStandard\Microsoft.Diagnostics.NETCore.Client.dll $coreCLRExtensionsDir -Force
# $null = New-Item -Force "$fullCLRExtensionsDir\procdump" -ItemType Directory
# $null = New-Item -Force "$coreCLRExtensionsDir\procdump" -ItemType Directory
# Copy-Item $blameDataCollectorNetFull\procdump.exe $fullCLRExtensionsDir\procdump -Force
# Copy-Item $blameDataCollectorNetFull\procdump64.exe $fullCLRExtensionsDir\procdump -Force
# Copy-Item $blameDataCollectorNetStandard\procdump.exe $coreCLRExtensionsDir\procdump -Force
# Copy-Item $blameDataCollectorNetStandard\procdump64.exe $coreCLRExtensionsDir\procdump -Force
# Copy-Item $blameDataCollectorNetStandard\procdump $coreCLRExtensionsDir\procdump -Force
# Copy blame data collector resource dlls
if ($TPB_LocalizedBuild) {
Copy-Loc-Files $blameDataCollectorNetFull $fullCLRExtensionsDir "Microsoft.TestPlatform.Extensions.BlameDataCollector.resources.dll"
Copy-Loc-Files $blameDataCollectorNetStandard $coreCLRExtensionsDir "Microsoft.TestPlatform.Extensions.BlameDataCollector.resources.dll"
}
# Copy Event Log Datacollector to Extensions folder.
$eventLogDataCollector = Join-Path $env:TP_ROOT_DIR "src\DataCollectors\Microsoft.TestPlatform.Extensions.EventLogCollector\bin\$TPB_Configuration"
$eventLogDataCollectorNetFull = Join-Path $eventLogDataCollector $TPB_TargetFramework451
Copy-Item $eventLogDataCollectorNetFull\Microsoft.TestPlatform.Extensions.EventLogCollector.dll $fullCLRExtensionsDir -Force
Copy-Item $eventLogDataCollectorNetFull\Microsoft.TestPlatform.Extensions.EventLogCollector.pdb $fullCLRExtensionsDir -Force
Copy-Item $eventLogDataCollectorNetFull\Microsoft.TestPlatform.Extensions.EventLogCollector.dll $coreCLRExtensionsDir -Force
Copy-Item $eventLogDataCollectorNetFull\Microsoft.TestPlatform.Extensions.EventLogCollector.pdb $coreCLRExtensionsDir -Force
# Copy EventLogCollector resource dlls
if ($TPB_LocalizedBuild) {
Copy-Loc-Files $eventLogDataCollectorNetFull $fullCLRExtensionsDir "Microsoft.TestPlatform.Extensions.EventLogCollector.resources.dll"
Copy-Loc-Files $eventLogDataCollectorNetFull $coreCLRExtensionsDir "Microsoft.TestPlatform.Extensions.EventLogCollector.resources.dll"
}
# Copy Microsoft.CodeCoverage.IO dlls
$codeCoverageExternalsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\eng\Versions.props)).Project.PropertyGroup.MicrosoftInternalCodeCoverageVersion
$codeCoverageIOPackagesDir = Join-Path $env:TP_PACKAGES_DIR "microsoft.codecoverage.io\$codeCoverageExternalsVersion\lib\$TPB_TargetFrameworkStandard"
Copy-Item $codeCoverageIOPackagesDir\Microsoft.CodeCoverage.IO.dll $coreCLR20PackageDir -Force
if ($TPB_LocalizedBuild) {
Copy-Loc-Files $codeCoverageIOPackagesDir $coreCLR20PackageDir "Microsoft.CodeCoverage.IO.resources.dll"
}
# If there are some dependencies for the TestHostRuntimeProvider assemblies, those need to be moved too.
$runtimeproviders = @("Microsoft.TestPlatform.TestHostRuntimeProvider.dll", "Microsoft.TestPlatform.TestHostRuntimeProvider.pdb")
foreach ($file in $runtimeproviders) {
Write-Verbose "Move-Item $fullCLRPackage451Dir\$file $fullCLRExtensionsDir -Force"
Move-Item $fullCLRPackage451Dir\$file $fullCLRExtensionsDir -Force
Write-Verbose "Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force"
Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force
}
# Move TestHostRuntimeProvider resource dlls
if ($TPB_LocalizedBuild) {
Move-Loc-Files $fullCLRPackage451Dir $fullCLRExtensionsDir "Microsoft.TestPlatform.TestHostRuntimeProvider.resources.dll"
Move-Loc-Files $coreCLR20PackageDir $coreCLRExtensionsDir "Microsoft.TestPlatform.TestHostRuntimeProvider.resources.dll"
}
# Copy dependency of Microsoft.TestPlatform.TestHostRuntimeProvider
$newtonsoft = Join-Path $env:TP_PACKAGES_DIR "newtonsoft.json\9.0.1\lib\net45\Newtonsoft.Json.dll"
Write-Verbose "Copy-Item $newtonsoft $fullCLRPackage451Dir -Force"
Copy-Item $newtonsoft $fullCLRPackage451Dir -Force
$newtonsoft = Join-Path $env:TP_PACKAGES_DIR "newtonsoft.json\9.0.1\lib\netstandard1.0\Newtonsoft.Json.dll"
Write-Verbose "Copy-Item $newtonsoft $coreCLR20PackageDir -Force"
Copy-Item $newtonsoft $coreCLR20PackageDir -Force
# Copy .NET Standard CPP Test adapter
New-Item "$fullCLRPackage451Dir\TestHost" -ItemType Directory -Force | Out-Null
$fullCLRTestHostDir = "$fullCLRPackage451Dir\TestHost"
$testPlatformRemoteExternalsVersion = ([xml](Get-Content "$env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props")).Project.PropertyGroup.TestPlatformRemoteExternalsVersion
$testPlatformRemoteExternalsSourceDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.TestPlatform.Remote\$testPlatformRemoteExternalsVersion\tools\netstandard\Extensions\*"
Copy-Item $testPlatformRemoteExternalsSourceDirectory $coreCLR20PackageDir -Force -Recurse
Copy-Item $testPlatformRemoteExternalsSourceDirectory $fullCLRTestHostDir -Force -Recurse
# Copy standalone testhost
$standaloneTesthost = Join-Path $env:TP_ROOT_DIR "temp\testhost\*"
Copy-Item $standaloneTesthost $coreCLR20PackageDir -Force
Copy-Item $testhostCore20PackageDir\testhost.dll $coreCLR20PackageDir -Force
Copy-Item $testhostCore20PackageDir\testhost.pdb $coreCLR20PackageDir -Force
Get-Item "$testhostCore20PackageDir\*" |
Where-Object { $_.Name -notin ("x64", "x86", "win7-x64", "win7-x86", "testhost.deps.json", "testhost.runtimeconfig.json") } |
Copy-Item -Recurse -Destination $fullCLRTestHostDir -Force
Copy-Item $standaloneTesthost $fullCLRTestHostDir -Force
# For libraries that are externally published, copy the output into artifacts. These will be signed and packaged independently.
Copy-PackageItems "Microsoft.TestPlatform.Build"
# Copy IntelliTrace components.
$testPlatformExternalsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.TestPlatformExternalsVersion
$intellitraceSourceDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Intellitrace\$testPlatformExternalsVersion\tools\net451"
$intellitraceTargetDirectory = Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Intellitrace"
if (-not (Test-Path $intellitraceTargetDirectory)) {
New-Item $intellitraceTargetDirectory -Type Directory -Force | Out-Null
}
Copy-Item -Recurse $intellitraceSourceDirectory\* $intellitraceTargetDirectory -Force
# Copy IntelliTrace Extensions components.
$intellitraceExtensionsSourceDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Intellitrace.Extensions\$testPlatformExternalsVersion\tools\net451"
if (-not (Test-Path $intellitraceExtensionsSourceDirectory)) {
New-Item $intellitraceExtensionsSourceDirectory -Type Directory -Force | Out-Null
}
Copy-Item -Recurse $intellitraceExtensionsSourceDirectory\* $intellitraceTargetDirectory -Force
# Copy Microsoft.VisualStudio.Telemetry APIs
$testPlatformDirectory = Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Intellitrace\Common7\IDE\Extensions\TestPlatform"
if (-not (Test-Path $testPlatformDirectory)) {
New-Item $testPlatformDirectory -Type Directory -Force | Out-Null
}
$visualStudioTelemetryDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.Telemetry\16.3.58\lib\net45"
$visualStudioRemoteControl = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.RemoteControl\16.3.23\lib\net45"
$visualStudioUtilitiesDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.Utilities.Internal\16.3.23\lib\net45"
Copy-Item "$visualStudioTelemetryDirectory\Microsoft.VisualStudio.Telemetry.dll" $testPlatformDirectory -Force
Copy-Item "$visualStudioRemoteControl\Microsoft.VisualStudio.RemoteControl.dll" $testPlatformDirectory -Force
Copy-Item "$visualStudioUtilitiesDirectory\Microsoft.VisualStudio.Utilities.Internal.dll" $testPlatformDirectory -Force
Copy-CodeCoverage-Package-Artifacts
Write-Log "Publish-Package: Complete. {$(Get-ElapsedTime($timer))}"
}
function Publish-Tests {
if ($TPB_PublishTests) {
Write-Log "Publish-Tests: Started."
# Adding only Perf project for now
$fullCLRTestDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework451"
$fullCLRPerfTestAssetDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework451\TestAssets\PerfAssets"
$mstest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "MSTest10kPassing"
$mstest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\MSTest10kPassing"
Publish-PackageInternal $mstest10kPerfProject $TPB_TargetFramework451 $mstest10kPerfProjectDir
$nunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "NUnit10kPassing"
$nunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\NUnit10kPassing"
Publish-PackageInternal $nunittest10kPerfProject $TPB_TargetFramework451 $nunittest10kPerfProjectDir
$xunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "XUnit10kPassing"
$xunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\XUnit10kPassing"
Publish-PackageInternal $xunittest10kPerfProject $TPB_TargetFramework451 $xunittest10kPerfProjectDir
$testPerfProject = Join-Path $env:TP_ROOT_DIR "test\Microsoft.TestPlatform.PerformanceTests"
Publish-PackageInternal $testPerfProject $TPB_TargetFramework48 $fullCLRTestDir
}
}
function Publish-PackageInternal($packagename, $framework, $output) {
$dotnetExe = Get-DotNetPath
Invoke-Exe $dotnetExe -Arguments "publish $packagename --configuration $TPB_Configuration --framework $framework --output $output -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild"
}
function Publish-PackageWithRuntimeInternal($packagename, $framework, $runtime, $selfcontained, $output) {
$dotnetExe = Get-DotNetPath
Invoke-Exe $dotnetExe -Arguments "publish $packagename --configuration $TPB_Configuration --framework $framework --runtime $runtime --self-contained $selfcontained --output $output -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild"
}
function Copy-Loc-Files($sourceDir, $destinationDir, $dllName) {
foreach ($lang in $language) {
$dllToCopy = Join-Path $sourceDir\$lang $dllName
$destinationFolder = Join-Path $destinationDir $lang
if (-not (Test-Path $destinationFolder)) {
New-Item $destinationFolder -Type Directory -Force | Out-Null
}
Copy-Item $dllToCopy $destinationFolder -Force
}
}
function Move-Loc-Files($sourceDir, $destinationDir, $dllName) {
foreach ($lang in $language) {
$dllToCopy = Join-Path $sourceDir\$lang $dllName
$destinationFolder = Join-Path $destinationDir $lang
if (-not (Test-Path $destinationFolder)) {
New-Item $destinationFolder -Type Directory -Force | Out-Null
}
Move-Item $dllToCopy $destinationFolder -Force
}
}
function Publish-VsixPackage {
Write-Log "Publish-VsixPackage: Started."
$timer = Start-Timer
$packageDir = Get-FullCLRPackageDirectory
$extensionsPackageDir = Join-Path $packageDir "Extensions"
$testImpactComComponentsDir = Join-Path $extensionsPackageDir "TestImpact"
$legacyTestImpactComComponentsDir = Join-Path $extensionsPackageDir "V1\TestImpact"
$testPlatformExternalsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.TestPlatformExternalsVersion
$testPlatformMsDiaVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.TestPlatformMSDiaVersion
$codeCoverageExternalsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\eng\Versions.props)).Project.PropertyGroup.MicrosoftInternalCodeCoverageVersion
$interopExternalsVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.InteropExternalsVersion
# Copy Microsoft.VisualStudio.IO to root
$codeCoverageIOPackageDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.CodeCoverage.IO\$codeCoverageExternalsVersion\lib\$TPB_TargetFramework451"
Copy-Item $codeCoverageIOPackageDirectory\Microsoft.CodeCoverage.IO.dll $packageDir -Force
if ($TPB_LocalizedBuild) {
Copy-Loc-Files $codeCoverageIOPackageDirectory $packageDir "Microsoft.CodeCoverage.IO.resources.dll"
}
# Copy legacy dependencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.TestPlatform.Extensions\$testPlatformExternalsVersion\tools\net451"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
# Copy Microsoft.VisualStudio.ArchitectureTools.PEReader to Extensions
Copy-Item $legacyDir\Microsoft.VisualStudio.ArchitectureTools.PEReader.dll $extensionsPackageDir -Force
# Copy QtAgent Related depedencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.QualityTools\$testPlatformExternalsVersion\tools\net451"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
# Copy Legacy data collectors Related depedencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.QualityTools.DataCollectors\$testPlatformExternalsVersion\tools\net451"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
# Copy CUIT Related depedencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.CUIT\$testPlatformExternalsVersion\tools\net451"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
# Copy Interop depedencies
$legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.Interop\$interopExternalsVersion\lib\net45"
Copy-Item -Recurse $legacyDir\* $packageDir -Force
# Copy COM Components and their manifests over
$comComponentsDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia\$testPlatformMsDiaVersion\tools\net451"
Copy-Item -Recurse $comComponentsDirectory\* $packageDir -Force
# Copy Microsoft.Internal.Dia.Interop
$internalDiaInterop = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia.Interop\$testPlatformMsDiaVersion\tools\net451"
Copy-Item -Recurse $internalDiaInterop\* $packageDir -Force
# Copy COM Components and their manifests over to Extensions Test Impact directory
$comComponentsDirectoryTIA = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia\$testPlatformMsDiaVersion\tools\net451"
if (-not (Test-Path $testImpactComComponentsDir)) {
New-Item $testImpactComComponentsDir -Type Directory -Force | Out-Null
}
Copy-Item -Recurse $comComponentsDirectoryTIA\* $testImpactComComponentsDir -Force
if (-not (Test-Path $legacyTestImpactComComponentsDir)) {
New-Item $legacyTestImpactComComponentsDir -Type Directory -Force | Out-Null
}
Copy-Item -Recurse $comComponentsDirectoryTIA\* $legacyTestImpactComComponentsDir -Force
Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "ThirdPartyNotices.txt") $packageDir -Force
Write-Log "Publish-VsixPackage: Complete. {$(Get-ElapsedTime($timer))}"
}
function Create-VsixPackage {
Write-Log "Create-VsixPackage: Started."
$timer = Start-Timer
Write-Verbose "Locating MSBuild install path..."
$msbuildPath = Locate-MSBuildPath
$vsixSourceDir = Join-Path $env:TP_ROOT_DIR "src\package\VSIXProject"
$vsixProjectDir = Join-Path $env:TP_OUT_DIR "$TPB_Configuration\VSIX"
# Create vsix only when msbuild is installed.
if (![string]::IsNullOrEmpty($msbuildPath)) {
# Copy the vsix project to artifacts directory to modify manifest
New-Item $vsixProjectDir -Type Directory -Force
Copy-Item -Recurse $vsixSourceDir\* $vsixProjectDir -Force
# Update version of VSIX
Update-VsixVersion $vsixProjectDir
# Build vsix project to get TestPlatform.vsix
Invoke-Exe $msbuildPath -Arguments """$vsixProjectDir\TestPlatform.csproj"" -p:Configuration=$Configuration"
}
else {
throw ".. Create-VsixPackage: Cannot generate vsix as msbuild.exe not found at '$msbuildPath'."
}
Write-Log "Create-VsixPackage: Complete. {$(Get-ElapsedTime($timer))}"
}
function Create-NugetPackages {
$timer = Start-Timer
Write-Log "Create-NugetPackages: Started."
$stagingDir = Join-Path $env:TP_OUT_DIR $TPB_Configuration
$packageOutputDir = $TPB_PackageOutDir
Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "Icon.png") $stagingDir -Force
# Packages folder should not be cleared on CI.
# Artifacts from source-build are downloaded into this directory before the build starts, and this would remove them.
if (-not $TPB_CIBuild) {
# Remove all locally built nuget packages before we start creating them
# we are leaving them in the folder after uzipping them for easier review.
if (Test-Path $packageOutputDir) {
Remove-Item $packageOutputDir -Recurse -Force
}
}
if (-not (Test-Path $packageOutputDir)) {
New-Item $packageOutputDir -Type directory -Force
}
$tpNuspecDir = Join-Path $env:TP_PACKAGE_PROJ_DIR "nuspec"
# Copy over the nuspecs to the staging directory
$nuspecFiles = @(
"Microsoft.CodeCoverage.nuspec",
"Microsoft.NET.Test.Sdk.nuspec",
"Microsoft.TestPlatform.AdapterUtilities.nuspec",
"Microsoft.TestPlatform.nuspec",
"Microsoft.TestPlatform.Portable.nuspec",
"TestPlatform.Extensions.TrxLogger.nuspec",
"TestPlatform.ObjectModel.nuspec",
"TestPlatform.TestHost.nuspec",
"TestPlatform.TranslationLayer.nuspec"
"TestPlatform.Internal.Uwp.nuspec"
)
$projectFiles = @(
"Microsoft.TestPlatform.CLI.csproj",
"Microsoft.TestPlatform.Build.csproj"
)
$dependencies = @(
"TestPlatform.Build.nuspec",
"TestPlatform.CLI.nuspec",
## .target and .props Files
"Microsoft.NET.Test.Sdk.props",
"Microsoft.CodeCoverage.props",
"Microsoft.CodeCoverage.targets",
## Content Directories
"netcoreapp",
"netfx"
)
# Nuget pack analysis emits warnings if binaries are packaged as content. It is intentional for the below packages.
$skipAnalysis = @(
"TestPlatform.CLI.nuspec",
"Microsoft.TestPlatform.CLI.csproj"
)
foreach ($item in $nuspecFiles + $projectFiles + $dependencies) {
Copy-Item $tpNuspecDir\$item $stagingDir -Force -Recurse
}
# Copy empty and third patry notice file
Copy-Item $tpNuspecDir\"_._" $stagingDir -Force
Copy-Item $tpNuspecDir\..\"ThirdPartyNotices.txt" $stagingDir -Force
Copy-Item $tpNuspecDir\..\"ThirdPartyNoticesCodeCoverage.txt" $stagingDir -Force
# Copy licenses folder
Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "licenses") $stagingDir -Force -Recurse
# Copy Uap target, & props
$testhostUapPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkUap100")
Copy-Item $tpNuspecDir\uap\"Microsoft.TestPlatform.TestHost.Uap.props" $testhostUapPackageDir\Microsoft.TestPlatform.TestHost.props -Force
Copy-Item $tpNuspecDir\uap\"Microsoft.TestPlatform.TestHost.Uap.targets" $testhostUapPackageDir\Microsoft.TestPlatform.TestHost.targets -Force
$testhostCore20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20")
Copy-Item $tpNuspecDir\"Microsoft.TestPlatform.TestHost.NetCore.props" $testhostCore20PackageDir\Microsoft.TestPlatform.TestHost.props -Force
$testhostCore10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore10")
Copy-Item $tpNuspecDir\"Microsoft.TestPlatform.TestHost.NetCore.props" $testhostCore10PackageDir\Microsoft.TestPlatform.TestHost.props -Force
# Call nuget pack on these components.
$nugetExe = Join-Path $env:TP_PACKAGES_DIR -ChildPath "Nuget.CommandLine" | Join-Path -ChildPath $env:NUGET_EXE_Version | Join-Path -ChildPath "tools\NuGet.exe"
$dotnetExe = Get-DotNetPath
# Pass Newtonsoft.Json version to nuget pack to keep the version consistent across all nuget packages.
$JsonNetVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.JsonNetVersion
# Additional external dependency folders
$microsoftFakesVersion = ([xml](Get-Content $env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props)).Project.PropertyGroup.MicrosoftFakesVersion
$FakesPackageDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.QualityTools.Testing.Fakes.TestRunnerHarness\$microsoftFakesVersion\contentFiles"
$uap100PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkUap100");
# package them from stagingDir
foreach ($file in $nuspecFiles) {
$additionalArgs = ""
if ($skipAnalysis -contains $file) {
$additionalArgs = "-NoPackageAnalysis"
}
if ($file -eq "TestPlatform.Internal.Uwp.nuspec") {
# this directory is mostly the same as the testhost10 dir, but has less libraries
# and does not have netstandard2.0 versions, so I don't copy them by mistake
$uap10Nuget = $uap100PackageDir
}
else {
$uap10Nuget = $testhostUapPackageDir
}
Invoke-Exe $nugetExe -Arguments "pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version;JsonNetVersion=$JsonNetVersion;Runtime=$TPB_TargetRuntime;NetCoreTargetFramework=$TPB_TargetFrameworkCore20;FakesPackageDir=$FakesPackageDir;NetStandard10Framework=$TPB_TargetFrameworkNS10;NetStandard13Framework=$TPB_TargetFrameworkNS13;NetStandard20Framework=$TPB_TargetFrameworkNS20;Uap10Framework=$uap10Nuget;BranchName=$TPB_BRANCH;CommitId=$TPB_COMMIT $additionalArgs"
}
foreach ($file in $projectFiles) {
$additionalArgs = ""
if ($skipAnalysis -contains $file) {
$additionalArgs = "-NoPackageAnalysis"
}
Write-Host "Attempting to build package from '$file'."
Invoke-Exe $dotnetExe -Arguments "restore $stagingDir\$file" -CaptureOutput | Out-Null
Invoke-Exe $dotnetExe -Arguments "pack --no-build $stagingDir\$file -o $packageOutputDir -p:Version=$TPB_Version -p:BranchName=`"$TPB_BRANCH`" -p:CommitId=`"$TPB_COMMIT`" /bl:pack_$file.binlog"
}