-
Notifications
You must be signed in to change notification settings - Fork 676
Expand file tree
/
Copy pathcheck_file_version.ps1
More file actions
147 lines (141 loc) · 4.68 KB
/
Copy pathcheck_file_version.ps1
File metadata and controls
147 lines (141 loc) · 4.68 KB
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
# Check File Version
#
# This script checks the version exe and dll the files in the Dynamo's bin directory.
# It compares the version of each file with the version of DynamoSandbox.exe.
# If the version of a file doesn't match the version of DynamoSandbox.exe, the script will exit with an error code.
#
# https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.fileversioninfo
param (
[Parameter(Mandatory = $true)][string]$path
)
$ErrorActionPreference = "Stop"
$includedFiles = @("*.exe", "*.dll")
$excludedFiles = @(
"*.config",
"*.ds",
"*.json",
"*.md",
"*.rtf",
"*.xml",
"AdpSDKCSharpWrapper.dll",
"AdskIdentitySDK.dll",
"Analytics.NET.*.dll",
"Autodesk*.dll",
"CommandLine.dll",
"Cyotek.Drawing.BitmapFont.dll",
"DiffPlex.dll",
"DocumentFormat.OpenXml.dll",
"DotNetProjects.Wpf.Extended.Toolkit.dll",
"Dynamo.Microsoft.Xaml.Behaviors.dll",
"FontAwesome5*.dll",
"ForgeUnitsManaged.dll",
"Greg.dll",
"HarfBuzzSharp.dll",
"HelixToolkit*.dll",
"ICSharpCode.AvalonEdit.dll",
"J2N.dll",
"JUnit.TestLogger.dll",
"LaunchDarkly.*",
"LibG*.dll",
"libiconv.dll", # https://jira.autodesk.com/browse/DYN-7069
"libintl.dll", # https://jira.autodesk.com/browse/DYN-7069
"libHarfBuzzSharp.dll", # https://jira.autodesk.com/browse/DYN-6598
"libSkiaSharp.dll", # https://jira.autodesk.com/browse/DYN-6598
"LiveChartsCore*.dll",
"Lucene.Net*.dll",
"MIConvexHull.dll",
"Microsoft.*",
"MimeMapping.dll",
"Moq.dll",
"Newtonsoft.Json.dll",
"NuGet.Frameworks.dll",
"nunit*.dll",
"NUnit3*.dll",
"Prism.dll",
"ProtoGeometry*.dll",
"Python*.dll",
"RestSharp.dll",
"SharpDX*.dll",
"SkiaSharp*.dll",
"Spekt.TestLogger.dll",
"StarMath.dll",
"System.*.dll",
"testcentric.engine.metadata.dll",
"testhost.dll",
"testhost.exe",
"TuneUp.dll",
"TuneUp.resources.dll",
"Units.dll",
"Webview2Loader.dll",
"DSPythonNet3.dll",
"DSPythonNet3.resources.dll",
"DSPythonNet3Extension.dll",
"DSPythonNet3Empty.dll",
"DSPythonNet3Wheels.dll",
# DynamoMCP built-in package (DYN-10553) — versioned independently of Dynamo, signed in its own pipeline.
"MCPExtension.dll",
"MCPServer.dll",
"ModelContextProtocol*.dll",
"JsonSchema.Net.dll",
"JsonPointer.Net.dll",
"Json.More.dll",
"DynamoPlayer.*.dll",
# DynamoAssistant built-in package (DYN-10450) — versioned independently of Dynamo, signed in its own pipeline.
"AutodeskAssistantViewExtension.dll",
"AutodeskAssistantViewExtension.resources.dll",
"AdpSDKCSharpWrapper.dll",
"Analytics.NET.ADP.dll",
"Analytics.NET.Core.dll"
)
$noVersion = @()
$wrongVersion = @()
$dynamoSandbox = Join-Path -Path $path -ChildPath "DynamoSandbox.exe"
if (Test-Path $dynamoSandbox) {
$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($dynamoSandbox).FileVersion
try {
$dynamoVersion = [System.Version]::Parse($fileVersion)
Write-Output "::notice::ℹ️ DynamoSandbox.exe - $dynamoVersion`n"
} catch {
Write-Output "::error::❌ Failed to get the version of DynamoSandbox.exe"
exit 1
}
} else {
Write-Output "::error::⚠️ DynamoSandbox.exe was not found"
exit 1
}
$files = Get-ChildItem -Path $path -Include $includedFiles -Exclude $excludedFiles -Recurse -File
foreach ($file in $files) {
$name = $file.Name
try {
$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file).FileVersion
$version = [System.Version]::Parse($fileVersion)
if ($version -eq $dynamoVersion) {
Write-Host "✅ $name - $version"
} else {
Write-Host "❌ $name - $version"
$wrongVersion += $file
}
} catch {
Write-Host "❌ $name"
$noVersion += $file
}
}
if ($noVersion.Count -gt 0 -Or $wrongVersion.Count -gt 0) {
if ($noVersion.Count -gt 0) {
Write-Host "`n`e[4mThe following file(s) don't have version information`e[24m"
$title = "Missing version information"
foreach ($file in $noVersion) {
$message = "$($file.Name) - $($file.FullName)"
Write-Output "::error title=$title::$message"
}
}
if ($wrongVersion.Count -gt 0) {
Write-Host "`n`e[4mThe following file(s) don't have the expected version: $dynamoVersion`e[24m"
$title = "Unexpected version information"
foreach ($file in $wrongVersion) {
$message = "$($file.Name) - $($file.FullName) - $($(Get-Item $file).VersionInfo.FileVersion)"
Write-Output "::error title=$title::$message"
}
}
exit 1
}