-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCompareAssemblyVersions.linq
More file actions
46 lines (39 loc) · 1.06 KB
/
CompareAssemblyVersions.linq
File metadata and controls
46 lines (39 loc) · 1.06 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
<Query Kind="Program" />
void Main()
{
// Define the paths to the two folders containing assembly files
string folder1 = @"";
string folder2 = @"";
var folder1Dlls = Directory.GetFiles(folder1, "*.dll");
var folder2Dlls = Directory.GetFiles(folder2, "*.dll");
Console.WriteLine($"Folder1: {folder1}");
Console.WriteLine($"Folder2: {folder2}");
foreach (var dll1 in folder1Dlls)
{
string dllName = Path.GetFileName(dll1);
string dll2Path = Path.Combine(folder2, dllName);
if (File.Exists(dll2Path))
{
try
{
var version1 = AssemblyName.GetAssemblyName(dll1).Version;
var version2 = AssemblyName.GetAssemblyName(dll2Path).Version;
// Compare versions and report mismatches
if (version1 != version2)
{
Console.WriteLine($"{dllName} version mismatch:");
Console.WriteLine($" - Folder1: {version1}");
Console.WriteLine($" - Folder2: {version2}");
}
}
catch
{
Console.WriteLine($"{dllName} Couldnt read assembly version for");
}
}
else
{
Console.WriteLine($"{dll2Path} file missing.");
}
}
}