mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Get PowerShell version in PSVersionInfo using assembly attribute instead of FileVersionInfo (#14332)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace System.Management.Automation
|
||||
{
|
||||
s_psVersionTable = new PSVersionHashTable(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
string assemblyPath = typeof(PSVersionInfo).Assembly.Location;
|
||||
string productVersion = FileVersionInfo.GetVersionInfo(assemblyPath).ProductVersion;
|
||||
Assembly currentAssembly = typeof(PSVersionInfo).Assembly;
|
||||
string productVersion = currentAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
|
||||
// Get 'GitCommitId' and 'PSVersion' from the 'productVersion' assembly attribute.
|
||||
//
|
||||
|
||||
@@ -22,7 +22,6 @@ Describe "Validate start of console host" -Tag CI {
|
||||
'System.ComponentModel.TypeConverter.dll'
|
||||
'System.Console.dll'
|
||||
'System.Data.Common.dll'
|
||||
'System.Diagnostics.FileVersionInfo.dll'
|
||||
'System.Diagnostics.Process.dll'
|
||||
'System.Diagnostics.TraceSource.dll'
|
||||
'System.Diagnostics.Tracing.dll'
|
||||
@@ -67,6 +66,7 @@ Describe "Validate start of console host" -Tag CI {
|
||||
if ($IsWindows) {
|
||||
$allowedAssemblies += @(
|
||||
'Microsoft.PowerShell.CoreCLR.Eventing.dll'
|
||||
'System.Diagnostics.FileVersionInfo.dll'
|
||||
'System.DirectoryServices.dll'
|
||||
'System.Management.dll'
|
||||
'System.Security.Claims.dll'
|
||||
@@ -76,10 +76,7 @@ Describe "Validate start of console host" -Tag CI {
|
||||
}
|
||||
else {
|
||||
$allowedAssemblies += @(
|
||||
'System.Collections.Immutable.dll'
|
||||
'System.IO.MemoryMappedFiles.dll'
|
||||
'System.Net.Sockets.dll'
|
||||
'System.Reflection.Metadata.dll'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user