diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs index 986b890d49..0f354eeb9f 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs @@ -2,13 +2,15 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Reflection; + using Microsoft.Testing.Platform.Extensions; namespace Microsoft.VisualStudio.TestTools.UnitTesting; internal sealed class MSTestExtension : IExtension { - public string Uid => nameof(MSTestExtension); + public string Uid { get; } = GetExtensionUid(); public string DisplayName => "MSTest"; @@ -17,5 +19,11 @@ internal sealed class MSTestExtension : IExtension public string Description => "MSTest Framework for Microsoft Testing Platform"; public Task IsEnabledAsync() => Task.FromResult(true); + + private static string GetExtensionUid() + { + var assemblyMetadataAttributes = Assembly.GetEntryAssembly()?.GetCustomAttributes(); + return assemblyMetadataAttributes?.FirstOrDefault(x => x.Key == "MSTest.Extension.Uid")?.Value ?? nameof(MSTestExtension); + } } #endif diff --git a/src/Package/MSTest.Sdk/Sdk/Runner/Common.targets b/src/Package/MSTest.Sdk/Sdk/Runner/Common.targets index 9dec46ae83..6ba232002f 100644 --- a/src/Package/MSTest.Sdk/Sdk/Runner/Common.targets +++ b/src/Package/MSTest.Sdk/Sdk/Runner/Common.targets @@ -26,4 +26,8 @@ $(MicrosoftTestingExtensionsCodeCoverageVersion) + + + +