From 07d3c8e703d2b21546fd12505545dfc40f72da24 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 3 Sep 2020 11:24:36 -0700 Subject: [PATCH 1/3] Restore netcoreapp1.0 support for testhost --- .../TestExtensionPluginInformation.cs | 2 +- .../Microsoft.TestPlatform.Common.csproj | 4 ++-- .../Resources/Resources.Designer.cs | 3 ++- .../Utilities/FakesUtilities.cs | 4 ++-- ...TestPlatform.CommunicationUtilities.csproj | 4 ++-- .../Resources/Resources.Designer.cs | 3 ++- ...icrosoft.TestPlatform.CoreUtilities.csproj | 6 +++--- .../Tracing/EqtTrace.cs | 2 +- ...rosoft.TestPlatform.CrossPlatEngine.csproj | 7 +++++-- .../Resources/Resources.Designer.cs | 3 ++- .../Microsoft.TestPlatform.ObjectModel.csproj | 21 ++++++++++++++----- .../Navigation/PortableSymbolReader.cs | 5 +++++ .../Resources/CommonResources.Designer.cs | 3 ++- ...t.TestPlatform.PlatformAbstractions.csproj | 4 ++-- .../InferRunSettingsHelper.cs | 12 ++++++++++- .../Microsoft.TestPlatform.Utilities.csproj | 4 ++-- src/testhost.x86/TestHostTraceListener.cs | 18 ++++++++++++++++ src/testhost.x86/testhost.x86.csproj | 8 +++++-- src/testhost/testhost.csproj | 10 ++++++--- 19 files changed, 91 insertions(+), 32 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs index 679f2a0ff0..ac3face5da 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs @@ -81,7 +81,7 @@ private static string GetExtensionUri(Type testLoggerType) if (EqtTrace.IsErrorEnabled && string.IsNullOrEmpty(extensionUri)) { - EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attribute.", testLoggerType.ToString(), testLoggerType.Module.Name); + EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attribute.", testLoggerType.ToString(), testLoggerType.GetTypeInfo().Module.Name); } return extensionUri; diff --git a/src/Microsoft.TestPlatform.Common/Microsoft.TestPlatform.Common.csproj b/src/Microsoft.TestPlatform.Common/Microsoft.TestPlatform.Common.csproj index 7a7af2d6ce..3b7344455b 100644 --- a/src/Microsoft.TestPlatform.Common/Microsoft.TestPlatform.Common.csproj +++ b/src/Microsoft.TestPlatform.Common/Microsoft.TestPlatform.Common.csproj @@ -6,8 +6,8 @@ Microsoft.VisualStudio.TestPlatform.Common - netstandard2.0;net451 - netstandard2.0 + netstandard2.0;netstandard1.3;net451 + netstandard2.0;netstandard1.3 true diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs index 4e54d9b88e..65cdef171f 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs @@ -10,6 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Resources { using System; + using System.Reflection; /// @@ -39,7 +40,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Common.Resources.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Common.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs index 502de37d13..adb4ce29d9 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs @@ -242,8 +242,8 @@ private static Func, DataCollectorSettings { try { - Assembly assembly = Assembly.Load(FakesConfiguratorAssembly); - var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false); + Assembly assembly = Assembly.Load(new AssemblyName(FakesConfiguratorAssembly)); + var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false, false); var method = type?.GetMethod(CrossPlatformConfiguratorMethodName, new Type[] { typeof(IDictionary) }); if (method != null) { diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj b/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj index 1f9daa06dc..8419b36504 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj @@ -5,8 +5,8 @@ Microsoft.TestPlatform.CommunicationUtilities - netstandard2.0;net451 - netstandard2.0 + netstandard2.0;netstandard1.3;net451 + netstandard2.0;netstandard1.3 true true diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Resources/Resources.Designer.cs index 9ccddada2f..0a50b20672 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Resources/Resources.Designer.cs @@ -10,6 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources { using System; + using System.Reflection; /// @@ -39,7 +40,7 @@ internal Resources() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj b/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj index 91e61760a9..5c17e606b2 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj +++ b/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj @@ -6,8 +6,8 @@ Microsoft.TestPlatform.CoreUtilities - netstandard2.0;net451 - netstandard2.0 + netstandard2.0;netstandard1.3;net451 + netstandard2.0;netstandard1.3 @@ -20,7 +20,7 @@ - + 4.0.0 diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs index 6a798a33bc..7b13d802d3 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs @@ -50,7 +50,7 @@ public static TraceLevel TraceLevel #endif -#if NETSTANDARD2_0 +#if NETSTANDARD public static PlatformTraceLevel TraceLevel { get diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj b/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj index 2b4085b7e8..f350f7fd32 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj @@ -6,8 +6,8 @@ Microsoft.TestPlatform.CrossPlatEngine - netstandard2.0;net451 - netstandard2.0 + netstandard2.0;netstandard1.3;net451 + netstandard2.0;netstandard1.3 true @@ -26,6 +26,9 @@ true + + + diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 24d87bbeb9..683eb49355 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -10,6 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources { using System; + using System.Reflection; /// @@ -39,7 +40,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj index cd06e0ee08..20478c9b00 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj +++ b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj @@ -6,8 +6,8 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel - net451;netstandard2.0 - netstandard2.0 + net451;netstandard2.0;netstandard1.3 + netstandard2.0;netstandard1.3 Microsoft.TestPlatform.ObjectModel @@ -31,10 +31,21 @@ + + + + + + + + + + + + + + - - 1.6.0 - diff --git a/src/Microsoft.TestPlatform.ObjectModel/Navigation/PortableSymbolReader.cs b/src/Microsoft.TestPlatform.ObjectModel/Navigation/PortableSymbolReader.cs index 9a28728b3a..206f047f80 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Navigation/PortableSymbolReader.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Navigation/PortableSymbolReader.cs @@ -101,8 +101,13 @@ private void PopulateCacheForTypeAndMethodSymbols(string binaryPath) } catch (FileNotFoundException) { +#if !NETSTANDARD1_3 // fallback when the assembly is not loaded asm = Assembly.LoadFile(binaryPath); +#else + // fallback is not supported + throw; +#endif } foreach (var type in asm.GetTypes()) diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/CommonResources.Designer.cs b/src/Microsoft.TestPlatform.ObjectModel/Resources/CommonResources.Designer.cs index 6e8ee0bbb1..3a37b375e5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/CommonResources.Designer.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Resources/CommonResources.Designer.cs @@ -10,6 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources { using System; + using System.Reflection; /// @@ -39,7 +40,7 @@ internal CommonResources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources.CommonResources", typeof(CommonResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources.CommonResources", typeof(CommonResources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj index 329c10aa1d..d7e5483840 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj @@ -6,8 +6,8 @@ Microsoft.TestPlatform.PlatformAbstractions - netcoreapp2.1;net451;uap10.0;netstandard2.0 - netstandard2.0;netcoreapp2.1 + netcoreapp2.1;net451;uap10.0;netstandard2.0;netstandard1.0 + netstandard2.0;netstandard1.0;netcoreapp2.1 true NU1605 diff --git a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs index fc069da27e..c0edcb8f3f 100644 --- a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs +++ b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs @@ -715,11 +715,21 @@ private static bool IsPlatformIncompatible(Architecture sourcePlatform, Architec { return false; } - if (targetPlatform == Architecture.X64 && !Environment.Is64BitOperatingSystem) + if (targetPlatform == Architecture.X64 && !Is64BitOperatingSystem()) { return true; } return sourcePlatform != targetPlatform; + + bool Is64BitOperatingSystem() + { +#if !NETSTANDARD1_3 + return Environment.Is64BitOperatingSystem; +#else + // In the absence of APIs to check, assume the majority case + return true; +#endif + } } /// diff --git a/src/Microsoft.TestPlatform.Utilities/Microsoft.TestPlatform.Utilities.csproj b/src/Microsoft.TestPlatform.Utilities/Microsoft.TestPlatform.Utilities.csproj index 81f341c320..0323baf7e8 100644 --- a/src/Microsoft.TestPlatform.Utilities/Microsoft.TestPlatform.Utilities.csproj +++ b/src/Microsoft.TestPlatform.Utilities/Microsoft.TestPlatform.Utilities.csproj @@ -6,8 +6,8 @@ Microsoft.TestPlatform.Utilities - netstandard2.0;net451 - netstandard2.0 + netstandard2.0;netstandard1.3;net451 + netstandard2.0;netstandard1.3 diff --git a/src/testhost.x86/TestHostTraceListener.cs b/src/testhost.x86/TestHostTraceListener.cs index dda5876dd9..214b9db411 100644 --- a/src/testhost.x86/TestHostTraceListener.cs +++ b/src/testhost.x86/TestHostTraceListener.cs @@ -76,7 +76,21 @@ public static void ShowDialog(string stackTrace, string message, string detailMe private static DebugAssertException GetException(string message) { var debugTypes = new Type[] { typeof(Debug), typeof(Trace) }; +#if NETCOREAPP1_0 + Exception exceptionForStack; + try + { + throw new Exception(); + } + catch (Exception e) + { + exceptionForStack = e; + } + + var stack = new StackTrace(exceptionForStack, true); +#else var stack = new StackTrace(true); +#endif var debugMethodFound = false; var frameCount = 0; @@ -97,7 +111,11 @@ private static DebugAssertException GetException(string message) } } +#if NETCOREAPP1_0 + var stackTrace = string.Join(Environment.NewLine, stack.ToString().Replace(Environment.NewLine, "\n").Split('\n').Reverse().Take(frameCount).Reverse()); +#else var stackTrace = string.Join(Environment.NewLine, stack.ToString().Split(Environment.NewLine).TakeLast(frameCount)); +#endif var methodName = method != null ? $"{method.DeclaringType.Name}.{method.Name}" : ""; var wholeMessage = $"Method {methodName} failed with '{message}', and was translated to { typeof(DebugAssertException).FullName } to avoid terminating the process hosting the test."; diff --git a/src/testhost.x86/testhost.x86.csproj b/src/testhost.x86/testhost.x86.csproj index 535a6e6afb..34a04f8092 100644 --- a/src/testhost.x86/testhost.x86.csproj +++ b/src/testhost.x86/testhost.x86.csproj @@ -6,8 +6,8 @@ testhost.x86 - netcoreapp2.1;net451;net452;net46;net461;net462;net47;net471;net472;net48 - netcoreapp2.1 + netcoreapp2.1;netcoreapp1.0;net451;net452;net46;net461;net462;net47;net471;net472;net48 + netcoreapp2.1;netcoreapp1.0 true AnyCPU true @@ -19,6 +19,10 @@ + + + + diff --git a/src/testhost/testhost.csproj b/src/testhost/testhost.csproj index c239485d24..25efc8ec61 100644 --- a/src/testhost/testhost.csproj +++ b/src/testhost/testhost.csproj @@ -6,12 +6,12 @@ testhost - netcoreapp2.1;net451;net452;net46;net461;net462;net47;net471;net472;net48 - netcoreapp2.1 + netcoreapp2.1;netcoreapp1.0;net451;net452;net46;net461;net462;net47;net471;net472;net48 + netcoreapp2.1;netcoreapp1.0 Exe app.manifest - + win7-x64 false @@ -21,6 +21,10 @@ + + + + From a28dbd69277d382705e74e496b39ce375a54e678 Mon Sep 17 00:00:00 2001 From: Medeni Baykal <433724+Haplois@users.noreply.github.com> Date: Wed, 16 Sep 2020 01:04:31 +0200 Subject: [PATCH 2/3] Updated nuspec files to include netstandard13 and netcoreapp10. --- scripts/build.ps1 | 219 ++++++++++++------ scripts/verify-nupkgs.ps1 | 6 +- .../Microsoft.TestPlatform.ObjectModel.csproj | 18 +- .../nuspec/Microsoft.NET.Test.Sdk.nuspec | 6 + .../nuspec/TestPlatform.ObjectModel.nuspec | 175 +++++++++----- .../nuspec/TestPlatform.TestHost.nuspec | 74 +++++- 6 files changed, 350 insertions(+), 148 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index a2bf383069..9ca48bdd6b 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -38,7 +38,7 @@ Param( [Alias("ci")] [Switch] $CIBuild = $false, - [Parameter(Mandatory=$false)] + [Parameter(Mandatory=$false)] [Alias("pt")] [Switch] $PublishTestArtifacts = $false, @@ -96,8 +96,11 @@ $TPB_TestAssets_Solution = Join-Path $env:TP_ROOT_DIR "test\TestAssets\TestAsset $TPB_TargetFramework = "net451" $TPB_TargetFramework472 = "net472" $TPB_TargetFrameworkCore20 = "netcoreapp2.1" +$TPB_TargetFrameworkCore10 = "netcoreapp1.0" $TPB_TargetFrameworkUap = "uap10.0" $TPB_TargetFrameworkNS2_0 = "netstandard2.0" +$TPB_TargetFrameworkNS1_3 = "netstandard1.3" +$TPB_TargetFrameworkNS1_0 = "netstandard1.0" $TPB_Configuration = $Configuration $TPB_TargetRuntime = $TargetRuntime $TPB_X64_Runtime = "win7-x64" @@ -291,100 +294,163 @@ function Publish-Package Write-Log "Publish-Package: Started." $dotnetExe = Get-DotNetPath $fullCLRPackageDir = Get-FullCLRPackageDirectory + $netstandard10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS1_0"); + $netstandard13PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS1_3"); + $netstandard20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS2_0"); $coreCLR20PackageDir = Get-CoreCLR20PackageDirectory $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" + $testhostFullPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFramework\$TPB_TargetRuntime") - $testhostCorePackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20") - $testhostCorePackageX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X64_Runtime") - $testhostCorePackageX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X86_Runtime") - $testhostCorePackageTempX64Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X64_Runtime") - $testhostCorePackageTempX86Dir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\publishTemp\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20\$TPB_X86_Runtime") + $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") + $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") + + $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") + $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") + $testhostUapPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkUap") $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_TargetFramework $fullCLRPackageDir 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" Publish-PackageInternal $vstestConsoleProject $TPB_TargetFramework $fullCLRPackageDir Publish-PackageInternal $vstestConsoleProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir - + Write-Log "Package: Publish src\SettingsMigrator\SettingsMigrator.csproj" Publish-PackageInternal $settingsMigratorProject $TPB_TargetFramework $fullCLRPackageDir - + Write-Log "Package: Publish src\datacollector\datacollector.csproj" Publish-PackageInternal $dataCollectorProject $TPB_TargetFramework472 $fullCLRPackageDir Publish-PackageInternal $dataCollectorProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir - - # Publish testhost + ################################################################################ + # Publish testhost Write-Log "Package: Publish testhost\testhost.csproj" Publish-PackageInternal $testHostProject $TPB_TargetFramework $testhostFullPackageDir - Publish-PackageInternal $testHostProject $TPB_TargetFrameworkCore20 $testhostCorePackageDir + 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 $testhostCorePackageTempX64Dir - + 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_TargetFramework $testhostFullPackageDir - Publish-PackageWithRuntimeInternal $testHostx86Project $TPB_TargetFrameworkCore20 $TPB_X86_Runtime false $testhostCorePackageTempX86Dir - + Publish-PackageWithRuntimeInternal $testHostx86Project $TPB_TargetFrameworkCore20 $TPB_X86_Runtime false $testhostCore20PackageTempX86Dir + Publish-PackageWithRuntimeInternal $testHostx86Project $TPB_TargetFrameworkCore10 $TPB_X86_Runtime true $testhostCore10PackageTempX86Dir + # 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.exe" $testhostFullPackageDir\testhost.$tfm.exe -Force Copy-Item "$(Split-Path $testHostProject)\bin\$TPB_Configuration\$tfm\$TPB_X64_Runtime\testhost.pdb" $testhostFullPackageDir\testhost.$tfm.pdb -Force Copy-Item "$(Split-Path $testHostProject)\bin\$TPB_Configuration\$tfm\$TPB_X64_Runtime\testhost.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.x86.exe" $testhostFullPackageDir\testhost.$tfm.x86.exe -Force Copy-Item "$(Split-Path $testHostx86Project)\bin\$TPB_Configuration\$tfm\$TPB_X86_Runtime\testhost.x86.pdb" $testhostFullPackageDir\testhost.$tfm.x86.pdb -Force Copy-Item "$(Split-Path $testHostx86Project)\bin\$TPB_Configuration\$tfm\$TPB_X86_Runtime\testhost.x86.exe.config" $testhostFullPackageDir\testhost.$tfm.x86.exe.config -Force } - + # Copy the .NET core x86 and x64 testhost exes from tempPublish to required folder - New-Item -ItemType directory -Path $testhostCorePackageX64Dir -Force | Out-Null - Copy-Item $testhostCorePackageTempX64Dir\testhost* $testhostCorePackageX64Dir -Force -recurse - New-Item -ItemType directory -Path $testhostCorePackageX86Dir -Force | Out-Null - Copy-Item $testhostCorePackageTempX86Dir\testhost.x86* $testhostCorePackageX86Dir -Force -recurse + New-Item -ItemType directory -Path $testhostCore20PackageX64Dir -Force | Out-Null + Copy-Item $testhostCore20PackageTempX64Dir\testhost* $testhostCore20PackageX64Dir -Force -recurse + New-Item -ItemType directory -Path $testhostCore20PackageX86Dir -Force | Out-Null + Copy-Item $testhostCore20PackageTempX86Dir\testhost.x86* $testhostCore20PackageX86Dir -Force -recurse + + New-Item -ItemType directory -Path $testhostCore10PackageX64Dir -Force | Out-Null + Copy-Item $testhostCore10PackageTempX64Dir\testhost* $testhostCore10PackageX64Dir -Force -recurse + New-Item -ItemType directory -Path $testhostCore10PackageX86Dir -Force | Out-Null + Copy-Item $testhostCore10PackageTempX86Dir\testhost.x86* $testhostCore10PackageX86Dir -Force -recurse + # 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 - + Set-ScriptFailedOnError - + # Copy over the Full CLR built datacollector package assemblies to the Core CLR package folder along with testhost Publish-PackageInternal $dataCollectorProject $TPB_TargetFramework472 $fullDestDir New-Item -ItemType directory -Path $fullCLRPackageDir -Force | Out-Null Copy-Item $testhostFullPackageDir\* $fullCLRPackageDir -Force -recurse - + Set-ScriptFailedOnError - # Publish platform abstractions + ################################################################################ + # Publish Microsoft.TestPlatform.PlatformAbstractions $platformAbstraction = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.PlatformAbstractions\bin\$TPB_Configuration" - $platformAbstractionNetFull = Join-Path $platformAbstraction $TPB_TargetFramework - $platformAbstractionNetCore = Join-Path $platformAbstraction $TPB_TargetFrameworkCore20 - $platformAbstractionUap = Join-Path $platformAbstraction $TPB_TargetFrameworkUap - Copy-Item $platformAbstractionNetFull\* $fullCLRPackageDir -Force - Copy-Item $platformAbstractionNetCore\* $coreCLR20PackageDir -Force - Copy-Item $platformAbstractionUap\* $testhostUapPackageDir -Force - + & { + ($TPB_TargetFramework, $fullCLRPackageDir), # net451 + ($TPB_TargetFrameworkCore20, $coreCLR20PackageDir), # netcoreapp2.1 + ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 + # ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 + ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir), # netstandard2_0 + ($TPB_TargetFrameworkUap, $testhostUapPackageDir) # uap + } |ForEach-Object { + $from = Join-Path $platformAbstraction $_[0]; + $to = $_[1]; + + New-Item -ItemType directory -Path "$to\" -Force | Out-Null + Copy-Item "$from\*" $to -Force -Recurse; + } + + ################################################################################ + # Publish Microsoft.TestPlatform.CoreUtilities + $coreUtilities = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CoreUtilities\bin\$TPB_Configuration" + & { + ($TPB_TargetFramework, $fullCLRPackageDir), # net451 + # ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 + ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 + ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir) # netstandard2_0 + } |ForEach-Object { + $from = Join-Path $coreUtilities $_[0]; + $to = $_[1]; + + New-Item -ItemType directory -Path "$to\" -Force | Out-Null + Copy-Item "$from\*" $to -Force -Recurse; + }; + + ################################################################################ + # Publish Microsoft.TestPlatform.ObjectModel + $objectModel = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.ObjectModel\bin\$TPB_Configuration" + & { + ($TPB_TargetFramework, $fullCLRPackageDir), # net451 + # ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 + ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 + ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir) # netstandard2_0 + } |ForEach-Object { + $from = Join-Path $objectModel $_[0]; + $to = $_[1]; + + New-Item -ItemType directory -Path "$to\" -Force | Out-Null + Copy-Item "$from\*" $to -Force -Recurse; + }; + + ################################################################################ # Publish msdia $comComponentsDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia\14.0.0\contentFiles\any\any\ComComponents" - Copy-Item -Recurse $comComponentsDirectory\* $testhostCorePackageDir -Force + 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 @@ -400,7 +466,11 @@ function Publish-Package # 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") + $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 $fullCLRPackageDir\$file $fullCLRExtensionsDir -Force" Move-Item $fullCLRPackageDir\$file $fullCLRExtensionsDir -Force @@ -518,36 +588,36 @@ function Publish-Package function Publish-Tests { - if($TPB_PublishTests) - { - $dotnetExe = Get-DotNetPath - Write-Log "Publish-Tests: Started." - - # Adding only Perf project for now - $fullCLRTestDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework" - $fullCLRPerfTestAssetDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework\TestAssets\PerfAssets" + if($TPB_PublishTests) + { + $dotnetExe = Get-DotNetPath + Write-Log "Publish-Tests: Started." + + # Adding only Perf project for now + $fullCLRTestDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework" + $fullCLRPerfTestAssetDir = Join-Path $env:TP_TESTARTIFACTS "$TPB_Configuration\$TPB_TargetFramework\TestAssets\PerfAssets" - $mstest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "MSTestAdapterPerfTestProject" - $mstest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\MSTestAdapterPerfTestProject" - Publish-PackageInternal $mstest10kPerfProject $TPB_TargetFramework $mstest10kPerfProjectDir + $mstest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "MSTestAdapterPerfTestProject" + $mstest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\MSTestAdapterPerfTestProject" + Publish-PackageInternal $mstest10kPerfProject $TPB_TargetFramework $mstest10kPerfProjectDir - $nunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "NUnitAdapterPerfTestProject" - $nunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\NUnitAdapterPerfTestProject" - Publish-PackageInternal $nunittest10kPerfProject $TPB_TargetFramework $nunittest10kPerfProjectDir + $nunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "NUnitAdapterPerfTestProject" + $nunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\NUnitAdapterPerfTestProject" + Publish-PackageInternal $nunittest10kPerfProject $TPB_TargetFramework $nunittest10kPerfProjectDir - $xunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "XUnitAdapterPerfTestProject" - $xunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\XUnitAdapterPerfTestProject" - Publish-PackageInternal $xunittest10kPerfProject $TPB_TargetFramework $xunittest10kPerfProjectDir + $xunittest10kPerfProjectDir = Join-Path $fullCLRPerfTestAssetDir "XUnitAdapterPerfTestProject" + $xunittest10kPerfProject = Join-Path $env:TP_ROOT_DIR "test\TestAssets\PerfAssets\XUnitAdapterPerfTestProject" + Publish-PackageInternal $xunittest10kPerfProject $TPB_TargetFramework $xunittest10kPerfProjectDir - $testPerfProject = Join-Path $env:TP_ROOT_DIR "test\Microsoft.TestPlatform.PerformanceTests" - Publish-PackageInternal $testPerfProject $TPB_TargetFramework $fullCLRTestDir - } + $testPerfProject = Join-Path $env:TP_ROOT_DIR "test\Microsoft.TestPlatform.PerformanceTests" + Publish-PackageInternal $testPerfProject $TPB_TargetFramework $fullCLRTestDir + } } function Publish-PackageInternal($packagename, $framework, $output) { Write-Verbose "$dotnetExe publish $packagename --configuration $TPB_Configuration --framework $framework --output $output -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild" - & $dotnetExe publish $packagename --configuration $TPB_Configuration --framework $framework --output $output -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild + & $dotnetExe publish $packagename --configuration $TPB_Configuration --framework $framework --output $output -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild Set-ScriptFailedOnError } @@ -562,26 +632,26 @@ function Publish-PackageWithRuntimeInternal($packagename, $framework, $runtime, function Copy-Loc-Files($sourceDir, $destinationDir, $dllName) { - foreach($lang in $language) { + 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) { + 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 Create-VsixPackage @@ -613,7 +683,7 @@ function Create-VsixPackage $legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.QualityTools.DataCollectors\$testPlatformExternalsVersion\contentFiles\any\any" Copy-Item -Recurse $legacyDir\* $packageDir -Force - # Copy CUIT Related depedencies + # Copy CUIT Related depedencies $legacyDir = Join-Path $env:TP_PACKAGES_DIR "Microsoft.VisualStudio.CUIT\$testPlatformExternalsVersion\contentFiles\any\any" Copy-Item -Recurse $legacyDir\* $packageDir -Force @@ -628,7 +698,7 @@ function Create-VsixPackage } Copy-Item -Recurse $comComponentsDirectoryTIA\* $testImpactComComponentsDir -Force - if (-not (Test-Path $legacyTestImpactComComponentsDir)) { + if (-not (Test-Path $legacyTestImpactComComponentsDir)) { New-Item $legacyTestImpactComComponentsDir -Type Directory -Force | Out-Null } Copy-Item -Recurse $comComponentsDirectoryTIA\* $legacyTestImpactComComponentsDir -Force @@ -667,7 +737,7 @@ function Create-NugetPackages Write-Log "Create-NugetPackages: Started." $stagingDir = Join-Path $env:TP_OUT_DIR $TPB_Configuration - $packageOutputDir = $TPB_PackageOutDir + $packageOutputDir = $TPB_PackageOutDir if (-not (Test-Path $packageOutputDir)) { New-Item $packageOutputDir -type directory -Force @@ -705,9 +775,12 @@ function Create-NugetPackages $testhostUapPackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkUap") 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 - - $testhostCorePackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore20") - Copy-Item $tpNuspecDir\"Microsoft.TestPlatform.TestHost.NetCore.props" $testhostCorePackageDir\Microsoft.TestPlatform.TestHost.props -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" @@ -727,12 +800,11 @@ function Create-NugetPackages } Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version $additionalArgs" - & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version`;JsonNetVersion=$JsonNetVersion`;Runtime=$TPB_TargetRuntime`;NetCoreTargetFramework=$TPB_TargetFrameworkCore20`;FakesPackageDir=$FakesPackageDir $additionalArgs + & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutputDir -Version $TPB_Version -Properties Version=$TPB_Version`;JsonNetVersion=$JsonNetVersion`;Runtime=$TPB_TargetRuntime`;NetCoreTargetFramework=$TPB_TargetFrameworkCore20`;FakesPackageDir=$FakesPackageDir`;NetStandard10Framework=$TPB_TargetFrameworkNS1_0`;NetStandard13Framework=$TPB_TargetFrameworkNS1_3`;NetStandard20Framework=$TPB_TargetFrameworkNS2_0 $additionalArgs Set-ScriptFailedOnError } - # Verifies that expected number of files gets shipped in nuget packages. # Few nuspec uses wildcard characters. Verify-Nuget-Packages $packageOutputDir @@ -946,7 +1018,14 @@ function Build-SpecificProjects { Write-Log "Build-SpecificProjects: Started for pattern: $ProjectNamePatterns" # FrameworksAndOutDirs format ("", ""). - $FrameworksAndOutDirs =( ("net451", "net451\win7-x64"), ("netstandard2.0", "netcoreapp2.1"), ("netcoreapp2.1", "netcoreapp2.1")) + $FrameworksAndOutDirs = ( + ("net451", "net451\win7-x64"), + ("netstandard1.0", "netstandard1.0"), + ("netstandard1.3", "netstandard1.3"), + ("netstandard2.0", "netcoreapp2.1"), + ("netcoreapp2.1", "netcoreapp2.1") + ); + $dotnetPath = Get-DotNetPath # Get projects to build. diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index ca4fe4fbf0..3105d988b4 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -14,14 +14,14 @@ function Verify-Nuget-Packages($packageDirectory) Write-Log "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 29; - "Microsoft.NET.Test.Sdk" = 13; + "Microsoft.NET.Test.Sdk" = 18; "Microsoft.TestPlatform" = 477; "Microsoft.TestPlatform.Build" = 19; "Microsoft.TestPlatform.CLI" = 350; "Microsoft.TestPlatform.Extensions.TrxLogger" = 33; - "Microsoft.TestPlatform.ObjectModel" = 62; + "Microsoft.TestPlatform.ObjectModel" = 91; "Microsoft.TestPlatform.Portable" = 566; - "Microsoft.TestPlatform.TestHost" = 145; + "Microsoft.TestPlatform.TestHost" = 197; "Microsoft.TestPlatform.TranslationLayer" = 121} $nugetPackages = Get-ChildItem -Filter "*.nupkg" $packageDirectory | % { $_.FullName} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj index 20478c9b00..5a251ce15e 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj +++ b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj @@ -31,17 +31,17 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec b/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec index aef09290a6..ba59062cb5 100644 --- a/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec +++ b/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec @@ -22,6 +22,10 @@ + + + + @@ -33,10 +37,12 @@ + + diff --git a/src/package/nuspec/TestPlatform.ObjectModel.nuspec b/src/package/nuspec/TestPlatform.ObjectModel.nuspec index 342628c057..a484daa3c1 100644 --- a/src/package/nuspec/TestPlatform.ObjectModel.nuspec +++ b/src/package/nuspec/TestPlatform.ObjectModel.nuspec @@ -14,11 +14,26 @@ © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing - - + + + + + + + + + + + + + + + + + @@ -35,70 +50,106 @@ - - - - - - - + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/package/nuspec/TestPlatform.TestHost.nuspec b/src/package/nuspec/TestPlatform.TestHost.nuspec index d2f1343ff5..39d1a8e8b2 100644 --- a/src/package/nuspec/TestPlatform.TestHost.nuspec +++ b/src/package/nuspec/TestPlatform.TestHost.nuspec @@ -14,14 +14,21 @@ © Microsoft Corporation. All rights reserved. vstest visual-studio unittest testplatform mstest microsoft test testing + + + + + + + - + @@ -32,7 +39,24 @@ - + + + + + + + + + + + + + + + + + + @@ -146,8 +170,51 @@ + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -189,6 +256,5 @@ - From bb8b09417c37c48fa11dc5de4a7c9ba6c05567e9 Mon Sep 17 00:00:00 2001 From: Medeni Baykal <433724+Haplois@users.noreply.github.com> Date: Wed, 16 Sep 2020 16:50:38 +0200 Subject: [PATCH 3/3] PR fixes --- scripts/build.ps1 | 83 ++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 9ca48bdd6b..ec98e0390e 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -322,7 +322,6 @@ function Publish-Package $dataCollectorProject = Join-Path $env:TP_ROOT_DIR "src\datacollector\datacollector.csproj" Write-Log "Package: Publish src\package\package\package.csproj" - Publish-PackageInternal $packageProject $TPB_TargetFramework $fullCLRPackageDir Publish-PackageInternal $packageProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir @@ -373,12 +372,11 @@ function Publish-Package Copy-Item $testhostCore20PackageTempX64Dir\testhost* $testhostCore20PackageX64Dir -Force -recurse New-Item -ItemType directory -Path $testhostCore20PackageX86Dir -Force | Out-Null Copy-Item $testhostCore20PackageTempX86Dir\testhost.x86* $testhostCore20PackageX86Dir -Force -recurse - + New-Item -ItemType directory -Path $testhostCore10PackageX64Dir -Force | Out-Null Copy-Item $testhostCore10PackageTempX64Dir\testhost* $testhostCore10PackageX64Dir -Force -recurse New-Item -ItemType directory -Path $testhostCore10PackageX86Dir -Force | Out-Null Copy-Item $testhostCore10PackageTempX86Dir\testhost.x86* $testhostCore10PackageX86Dir -Force -recurse - # Copy over the Full CLR built testhost package assemblies to the Core CLR and Full CLR package folder. $coreCLRFull_Dir = "TestHost" @@ -398,53 +396,35 @@ function Publish-Package ################################################################################ # Publish Microsoft.TestPlatform.PlatformAbstractions - $platformAbstraction = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.PlatformAbstractions\bin\$TPB_Configuration" - & { - ($TPB_TargetFramework, $fullCLRPackageDir), # net451 - ($TPB_TargetFrameworkCore20, $coreCLR20PackageDir), # netcoreapp2.1 - ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 - # ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 - ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir), # netstandard2_0 - ($TPB_TargetFrameworkUap, $testhostUapPackageDir) # uap - } |ForEach-Object { - $from = Join-Path $platformAbstraction $_[0]; - $to = $_[1]; - - New-Item -ItemType directory -Path "$to\" -Force | Out-Null - Copy-Item "$from\*" $to -Force -Recurse; - } + Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.PlatformAbstractions\bin\$TPB_Configuration") ` + -files @{ + $TPB_TargetFramework = $fullCLRPackageDir # net451 + $TPB_TargetFrameworkCore20 = $coreCLR20PackageDir # netcoreapp2.1 + $TPB_TargetFrameworkNS1_0 = $netstandard10PackageDir # netstandard1_0 + # $TPB_TargetFrameworkNS1_3 = $netstandard13PackageDir # netstandard1_3 + $TPB_TargetFrameworkNS2_0 = $netstandard20PackageDir # netstandard2_0 + $TPB_TargetFrameworkUap = $testhostUapPackageDir # uap + } ################################################################################ # Publish Microsoft.TestPlatform.CoreUtilities - $coreUtilities = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CoreUtilities\bin\$TPB_Configuration" - & { - ($TPB_TargetFramework, $fullCLRPackageDir), # net451 - # ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 - ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 - ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir) # netstandard2_0 - } |ForEach-Object { - $from = Join-Path $coreUtilities $_[0]; - $to = $_[1]; - - New-Item -ItemType directory -Path "$to\" -Force | Out-Null - Copy-Item "$from\*" $to -Force -Recurse; - }; + Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.CoreUtilities\bin\$TPB_Configuration") ` + -files @{ + $TPB_TargetFramework = $fullCLRPackageDir # net451 + # $TPB_TargetFrameworkNS1_0 = $netstandard10PackageDir # netstandard1_0 + $TPB_TargetFrameworkNS1_3 = $netstandard13PackageDir # netstandard1_3 + $TPB_TargetFrameworkNS2_0 = $netstandard20PackageDir # netstandard2_0 + } ################################################################################ # Publish Microsoft.TestPlatform.ObjectModel - $objectModel = Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.ObjectModel\bin\$TPB_Configuration" - & { - ($TPB_TargetFramework, $fullCLRPackageDir), # net451 - # ($TPB_TargetFrameworkNS1_0, $netstandard10PackageDir), # netstandard1_0 - ($TPB_TargetFrameworkNS1_3, $netstandard13PackageDir), # netstandard1_3 - ($TPB_TargetFrameworkNS2_0, $netstandard20PackageDir) # netstandard2_0 - } |ForEach-Object { - $from = Join-Path $objectModel $_[0]; - $to = $_[1]; - - New-Item -ItemType directory -Path "$to\" -Force | Out-Null - Copy-Item "$from\*" $to -Force -Recurse; - }; + Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.ObjectModel\bin\$TPB_Configuration") ` + -files @{ + $TPB_TargetFramework = $fullCLRPackageDir # net451 + # $TPB_TargetFrameworkNS1_0 = $netstandard10PackageDir # netstandard1_0 + $TPB_TargetFrameworkNS1_3 = $netstandard13PackageDir # netstandard1_3 + $TPB_TargetFrameworkNS2_0 = $netstandard20PackageDir # netstandard2_0 + } ################################################################################ # Publish msdia @@ -586,6 +566,21 @@ function Publish-Package Write-Log "Publish-Package: Complete. {$(Get-ElapsedTime($timer))}" } +function Copy-Bulk { + param ( + [string]$root, + [hashtable]$files + ) + + $files.GetEnumerator() | ForEach-Object { + $from = Join-Path $root $_.Name + $to = $_.Value + + New-Item -ItemType directory -Path "$to\" -Force | Out-Null + Copy-Item "$from\*" $to -Force -Recurse + } +} + function Publish-Tests { if($TPB_PublishTests)