Skip to content

Instantly share code, notes, and snippets.

@bic742
Created January 25, 2023 14:59
Show Gist options
  • Save bic742/e7c6dc463f27122201fb167c71247d7d to your computer and use it in GitHub Desktop.
Save bic742/e7c6dc463f27122201fb167c71247d7d to your computer and use it in GitHub Desktop.
This PowerShell script will scan all projects in a given solution for specific assembly and output the project name + assembly version when found. This is intended to be used to locate where a rogue assembly may be coming from in your running environment and get the version aligned with the rest of the system.
$searchPath = "C:\my_repo\src"
$assemblyName = "Sitecore.Horizon.Integration"
$versionPathMap = @{}
$files = Get-ChildItem -Path $searchPath -Recurse |
Where-Object { $_.Name -eq "$assemblyName.dll" }
foreach ($file in $files) {
$versionPathMap.Add($file.FullName, [Reflection.AssemblyName]::GetAssemblyName($file.FullName).Version)
}
foreach ($key in $versionPathMap.Keys) {
Write-Host "$key - $($versionPathMap[$key])"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment