From 3fa917c5f311eee004eab8362eec6ff6771158c4 Mon Sep 17 00:00:00 2001 From: Medeni Baykal <433724+Haplois@users.noreply.github.com> Date: Wed, 10 Aug 2022 16:05:12 +0200 Subject: [PATCH] Fixed issues with SDK style projects. --- scripts/Build.ps1 | 6 ++- scripts/build/TestFx.props | 6 +++ scripts/build/TestFx.targets | 51 +++++++++++++------ .../Discovery/AssemblyEnumerator.cs | 3 +- .../MSTest.CoreAdapter.csproj | 1 - .../ObjectModel/TestMethod.cs | 4 ++ .../ObjectModel/UnitTestElement.cs | 39 +++++++------- .../PlatformServices.Desktop.csproj | 1 - .../Properties/AssemblyInfo.cs | 32 ------------ .../PlatformServices.Interface.csproj | 1 - .../PlatformServices.NetCore.csproj | 1 - .../PlatformServices.Portable.csproj | 1 - .../PlatformServices.Universal.csproj | 1 - .../PlatformServices.WinUI.csproj | 1 - .../Properties/AssemblyInfo.cs | 5 -- ...STest.Internal.TestFx.Documentation.nuspec | 2 +- src/Package/MSTest.TestAdapter.nuspec | 2 +- src/Package/MSTest.TestAdapter.symbols.nuspec | 2 +- src/Package/MSTest.TestFramework.nuspec | 2 +- .../MSTest.TestFramework.symbols.nuspec | 2 +- src/Package/MSTest.nuspec | 2 +- .../Extension.Core/Extension.Core.csproj | 1 - .../Extension.Desktop.csproj | 1 - .../Extension.UWP/Extension.UWP.csproj | 1 - .../Extension.WinUI/Extension.WinUI.csproj | 1 - .../MSTest.Core/MSTest.Core.csproj | 1 - .../DiscoveryAndExecutionTests.csproj | 1 - ...PlatformServices.NetCore.Unit.Tests.csproj | 1 - 28 files changed, 78 insertions(+), 94 deletions(-) diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index cd230e3fd5..c0ed726018 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -234,6 +234,8 @@ function Invoke-MSBuild([string]$solution, $buildTarget = $Target, $hasVsixExten "-p:IsLocalizedBuild=$TFB_IsLocalizedBuild", "-p:UpdateXlf=$TFB_UpdateXlf", "-p:BuildVersion=$TFB_BuildVersion", + "-p:BranchName=`"$TPB_BRANCH`"", + "-p:CommitHash=$TPB_COMMIT", "-restore:$restore", "`"$solutionPath`"", "-bl:`"$binLog`"", @@ -304,8 +306,8 @@ function Create-NugetPackages { $SystemPrivateUriVersion = Get-PackageVersion -PackageName "SystemPrivateUriVersion" $SystemXmlReaderWriterVersion = Get-PackageVersion -PackageName "SystemXmlReaderWriterVersion" - Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version``;Srcroot=$env:TF_SRC_DIR``;Packagesroot=$env:TF_PACKAGES_DIR``;TestPlatformVersion=$TestPlatformVersion``;MicrosoftNETCoreUniversalWindowsPlatformVersion=$MicrosoftNETCoreUniversalWindowsPlatformVersion``;SystemNetWebSocketsClientVersion=$SystemNetWebSocketsClientVersion``;SystemTextRegularExpressionsVersion=$SystemTextRegularExpressionsVersion``;SystemPrivateUriVersion=$SystemPrivateUriVersion``;SystemXmlReaderWriterVersion=$SystemXmlReaderWriterVersion``;SystemNetNameResolutionVersion=$SystemNetNameResolutionVersion``;NOWARN=`"NU5127,NU5128,NU5129`"``;BranchName=$TPB_BRANCH``;CommitId=$TPB_COMMIT" - & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version`;Srcroot=$env:TF_SRC_DIR`;Packagesroot=$env:TF_PACKAGES_DIR`;TestPlatformVersion=$TestPlatformVersion`;MicrosoftNETCoreUniversalWindowsPlatformVersion=$MicrosoftNETCoreUniversalWindowsPlatformVersion`;SystemNetWebSocketsClientVersion=$SystemNetWebSocketsClientVersion`;SystemTextRegularExpressionsVersion=$SystemTextRegularExpressionsVersion`;SystemPrivateUriVersion=$SystemPrivateUriVersion`;SystemXmlReaderWriterVersion=$SystemXmlReaderWriterVersion`;SystemNetNameResolutionVersion=$SystemNetNameResolutionVersion`;NOWARN="NU5127,NU5128,NU5129"`;BranchName=$TPB_BRANCH`;CommitId=$TPB_COMMIT + Write-Verbose "$nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version``;Srcroot=$env:TF_SRC_DIR``;Packagesroot=$env:TF_PACKAGES_DIR``;TestPlatformVersion=$TestPlatformVersion``;MicrosoftNETCoreUniversalWindowsPlatformVersion=$MicrosoftNETCoreUniversalWindowsPlatformVersion``;SystemNetWebSocketsClientVersion=$SystemNetWebSocketsClientVersion``;SystemTextRegularExpressionsVersion=$SystemTextRegularExpressionsVersion``;SystemPrivateUriVersion=$SystemPrivateUriVersion``;SystemXmlReaderWriterVersion=$SystemXmlReaderWriterVersion``;SystemNetNameResolutionVersion=$SystemNetNameResolutionVersion``;NOWARN=`"NU5127,NU5128,NU5129`"``;BranchName=$TPB_BRANCH``;CommitHash=$TPB_COMMIT" + & $nugetExe pack $stagingDir\$file -OutputDirectory $packageOutDir -Version $version -Properties Version=$version`;Srcroot=$env:TF_SRC_DIR`;Packagesroot=$env:TF_PACKAGES_DIR`;TestPlatformVersion=$TestPlatformVersion`;MicrosoftNETCoreUniversalWindowsPlatformVersion=$MicrosoftNETCoreUniversalWindowsPlatformVersion`;SystemNetWebSocketsClientVersion=$SystemNetWebSocketsClientVersion`;SystemTextRegularExpressionsVersion=$SystemTextRegularExpressionsVersion`;SystemPrivateUriVersion=$SystemPrivateUriVersion`;SystemXmlReaderWriterVersion=$SystemXmlReaderWriterVersion`;SystemNetNameResolutionVersion=$SystemNetNameResolutionVersion`;NOWARN="NU5127,NU5128,NU5129"`;BranchName=$TPB_BRANCH`;CommitHash=$TPB_COMMIT if ($lastExitCode -ne 0) { throw "Nuget pack failed with an exit code of '$lastExitCode'." } diff --git a/scripts/build/TestFx.props b/scripts/build/TestFx.props index 4645f57dc4..45cee56d8e 100644 --- a/scripts/build/TestFx.props +++ b/scripts/build/TestFx.props @@ -8,6 +8,12 @@ false + + BRANCHNAME + COMMITHASH + $(CommitHash.SubString(0, 8)) + + diff --git a/scripts/build/TestFx.targets b/scripts/build/TestFx.targets index 7446d5cf71..478dcb2cff 100644 --- a/scripts/build/TestFx.targets +++ b/scripts/build/TestFx.targets @@ -14,7 +14,6 @@ - + + + + + + + <_Parameter1>$(Company) + + + <_Parameter1>$(Copyright) + + <_Parameter1>$(AssemblyVersion) - - - <_Parameter1>$(BuildVersion) - - - <_Parameter1>$(BuildVersion) - + + + <_Parameter1>$(FileVersion) + + + <_Parameter1>$(InformationalVersion) + + + <_Parameter1>RepositoryUrl + <_Parameter2 Condition="'$(RepositoryUrl)' != ''">$(RepositoryUrl) + <_Parameter2 Condition="'$(RepositoryUrl)' == ''">$(PrivateRepositoryUrl) + + + <_Parameter1>%(AssemblyMetadata.Identity) + <_Parameter2>%(AssemblyMetadata.Value) + - + - + diff --git a/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumerator.cs b/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumerator.cs index edad22c1c3..884be4ef31 100644 --- a/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumerator.cs +++ b/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumerator.cs @@ -211,7 +211,8 @@ private IEnumerable DiscoverTestsInType(string assemblyFileName try { typeFullName = type.FullName; - var unitTestCases = this.GetTypeEnumerator(type, assemblyFileName, discoverInternals).Enumerate(out var warningsFromTypeEnumerator); + var testTypeEnumerator = this.GetTypeEnumerator(type, assemblyFileName, discoverInternals); + var unitTestCases = testTypeEnumerator.Enumerate(out var warningsFromTypeEnumerator); var typeIgnored = ReflectHelper.IsAttributeDefined(type, typeof(UTF.IgnoreAttribute), false); if (warningsFromTypeEnumerator != null) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj index 2481508d9f..c54a329d3d 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj +++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs index e8e998d462..ce8989f4a0 100644 --- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs +++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs @@ -47,8 +47,10 @@ public TestMethod(string name, string fullClassName, string assemblyName, bool i this.IsAsync = isAsync; var hierarchy = new string[HierarchyConstants.Levels.TotalLevelCount]; + hierarchy[HierarchyConstants.Levels.ContainerIndex] = null; hierarchy[HierarchyConstants.Levels.NamespaceIndex] = fullClassName; hierarchy[HierarchyConstants.Levels.ClassIndex] = name; + hierarchy[HierarchyConstants.Levels.TestGroupIndex] = name; this.hierarchy = new ReadOnlyCollection(hierarchy); } @@ -62,6 +64,8 @@ internal TestMethod(MethodBase method, string name, string fullClassName, string } ManagedNameHelper.GetManagedName(method, out var managedType, out var managedMethod, out var hierarchyValues); + hierarchyValues[HierarchyConstants.Levels.ContainerIndex] = null; // This one will be set by test windows to current test project name. + this.ManagedTypeName = managedType; this.ManagedMethodName = managedMethod; this.hierarchy = new ReadOnlyCollection(hierarchyValues); diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs index c1b38dacd5..d2af64c1f9 100644 --- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs +++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs @@ -229,25 +229,26 @@ internal TestCase ToTestCase() { } - var idProvider = new TestIdProvider(); - idProvider.AppendString(testCase.ExecutorUri?.ToString()); - idProvider.AppendString(fileName); - if (this.TestMethod.HasManagedMethodAndTypeProperties) - { - idProvider.AppendString(this.TestMethod.ManagedTypeName); - idProvider.AppendString(this.TestMethod.ManagedMethodName); - } - else - { - idProvider.AppendString(testCase.FullyQualifiedName); - } - - if (this.TestMethod.DataType != DynamicDataType.None) - { - idProvider.AppendString(testCase.DisplayName); - } - - testCase.Id = idProvider.GetId(); + // This code is disabled for compatibility. + // var idProvider = new TestIdProvider(); + // idProvider.AppendString(testCase.ExecutorUri?.ToString()); + // idProvider.AppendString(fileName); + // if (this.TestMethod.HasManagedMethodAndTypeProperties) + // { + // idProvider.AppendString(this.TestMethod.ManagedTypeName); + // idProvider.AppendString(this.TestMethod.ManagedMethodName); + // } + // else + // { + // idProvider.AppendString(testCase.FullyQualifiedName); + // } + // + // if (this.TestMethod.DataType != DynamicDataType.None) + // { + // idProvider.AppendString(testCase.DisplayName); + // } + // + // testCase.Id = idProvider.GetId(); return testCase; } diff --git a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj index 8518f60dd6..f93a75b193 100644 --- a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj +++ b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/Adapter/PlatformServices.Desktop/Properties/AssemblyInfo.cs b/src/Adapter/PlatformServices.Desktop/Properties/AssemblyInfo.cs index 58ba052de6..0569f36ab8 100644 --- a/src/Adapter/PlatformServices.Desktop/Properties/AssemblyInfo.cs +++ b/src/Adapter/PlatformServices.Desktop/Properties/AssemblyInfo.cs @@ -6,39 +6,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PlatformServices.Desktop")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft Corporation")] -[assembly: AssemblyProduct("PlatformServices.Desktop")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b0fce474-14bc-449a-91ea-a433342c0d63")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] - -// This is set by GlobalAssemblyInfo which is auto-generated due to import of TestPlatform.NonRazzle.targets -// [assembly: AssemblyVersion("1.0.0.0")] -// [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TypeForwardedTo(typeof(SerializableAttribute))] [assembly: TypeForwardedTo(typeof(MarshalByRefObject))] diff --git a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj index 40568fc290..2d9c448128 100644 --- a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj +++ b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj index 036ddbb3ce..72748a6f96 100644 --- a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj +++ b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj @@ -8,7 +8,6 @@ - false false false diff --git a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj index 19fc5fa6f4..1d8c60300e 100644 --- a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj +++ b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/Adapter/PlatformServices.Universal/PlatformServices.Universal.csproj b/src/Adapter/PlatformServices.Universal/PlatformServices.Universal.csproj index 4884394e6a..ad70158a7a 100644 --- a/src/Adapter/PlatformServices.Universal/PlatformServices.Universal.csproj +++ b/src/Adapter/PlatformServices.Universal/PlatformServices.Universal.csproj @@ -30,7 +30,6 @@ - false false diff --git a/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj b/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj index a04f181e5d..786d71f57a 100644 --- a/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj +++ b/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj @@ -13,7 +13,6 @@ - false false false diff --git a/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs b/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs index 81824e9394..1dcc95ee87 100644 --- a/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs +++ b/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs @@ -7,11 +7,6 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; -[assembly: AssemblyDescription("")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - [assembly: ComVisible(false)] [assembly: TypeForwardedTo(typeof(SerializableAttribute))] diff --git a/src/Package/MSTest.Internal.TestFx.Documentation.nuspec b/src/Package/MSTest.Internal.TestFx.Documentation.nuspec index 3c8e03634d..70311651b1 100644 --- a/src/Package/MSTest.Internal.TestFx.Documentation.nuspec +++ b/src/Package/MSTest.Internal.TestFx.Documentation.nuspec @@ -19,7 +19,7 @@ + commit="$CommitHash$" /> diff --git a/src/Package/MSTest.TestAdapter.nuspec b/src/Package/MSTest.TestAdapter.nuspec index eaa7483c54..406097fc2a 100644 --- a/src/Package/MSTest.TestAdapter.nuspec +++ b/src/Package/MSTest.TestAdapter.nuspec @@ -27,7 +27,7 @@ + commit="$CommitHash$" /> diff --git a/src/Package/MSTest.TestAdapter.symbols.nuspec b/src/Package/MSTest.TestAdapter.symbols.nuspec index 40fe1f6e35..dde6e2c9ad 100644 --- a/src/Package/MSTest.TestAdapter.symbols.nuspec +++ b/src/Package/MSTest.TestAdapter.symbols.nuspec @@ -27,7 +27,7 @@ + commit="$CommitHash$" /> diff --git a/src/Package/MSTest.TestFramework.nuspec b/src/Package/MSTest.TestFramework.nuspec index 89a8087487..3cc00c5786 100644 --- a/src/Package/MSTest.TestFramework.nuspec +++ b/src/Package/MSTest.TestFramework.nuspec @@ -30,7 +30,7 @@ + commit="$CommitHash$" /> diff --git a/src/Package/MSTest.TestFramework.symbols.nuspec b/src/Package/MSTest.TestFramework.symbols.nuspec index a45c452d57..376ff5f7f2 100644 --- a/src/Package/MSTest.TestFramework.symbols.nuspec +++ b/src/Package/MSTest.TestFramework.symbols.nuspec @@ -29,7 +29,7 @@ + commit="$CommitHash$" /> diff --git a/src/Package/MSTest.nuspec b/src/Package/MSTest.nuspec index fc0b60e519..ac1e76c004 100644 --- a/src/Package/MSTest.nuspec +++ b/src/Package/MSTest.nuspec @@ -27,7 +27,7 @@ + commit="$CommitHash$" /> diff --git a/src/TestFramework/Extension.Core/Extension.Core.csproj b/src/TestFramework/Extension.Core/Extension.Core.csproj index 09831ff87d..6ac2aaa74c 100644 --- a/src/TestFramework/Extension.Core/Extension.Core.csproj +++ b/src/TestFramework/Extension.Core/Extension.Core.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj b/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj index 633d14175f..ace913de5f 100644 --- a/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj +++ b/src/TestFramework/Extension.Desktop/Extension.Desktop.csproj @@ -18,7 +18,6 @@ - false false diff --git a/src/TestFramework/Extension.UWP/Extension.UWP.csproj b/src/TestFramework/Extension.UWP/Extension.UWP.csproj index 717f8afe1e..5bd9bd0fde 100644 --- a/src/TestFramework/Extension.UWP/Extension.UWP.csproj +++ b/src/TestFramework/Extension.UWP/Extension.UWP.csproj @@ -30,7 +30,6 @@ - false false diff --git a/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj b/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj index 7803699c1d..a9701fdd10 100644 --- a/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj +++ b/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj @@ -6,7 +6,6 @@ Extension.WinUI Extension.WinUI © Microsoft Corporation. All rights reserved. - true net5.0-windows10.0.18362.0 10.0.18362.0 diff --git a/src/TestFramework/MSTest.Core/MSTest.Core.csproj b/src/TestFramework/MSTest.Core/MSTest.Core.csproj index 93cc25aece..9d9acf5936 100644 --- a/src/TestFramework/MSTest.Core/MSTest.Core.csproj +++ b/src/TestFramework/MSTest.Core/MSTest.Core.csproj @@ -18,7 +18,6 @@ - false false diff --git a/test/E2ETests/DiscoveryAndExecutionTests/DiscoveryAndExecutionTests.csproj b/test/E2ETests/DiscoveryAndExecutionTests/DiscoveryAndExecutionTests.csproj index 34c2093c6b..32636d52c9 100644 --- a/test/E2ETests/DiscoveryAndExecutionTests/DiscoveryAndExecutionTests.csproj +++ b/test/E2ETests/DiscoveryAndExecutionTests/DiscoveryAndExecutionTests.csproj @@ -5,7 +5,6 @@ false 1685 - true false diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj index 2cbf3b1ac1..b83be687f5 100644 --- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj @@ -8,7 +8,6 @@ true CS1685 false - true