#### We can get details of assembly\dll using powershell
```sh
$AppBin="c:\<appPath>\<bin>"
Get-ChildItem -Path $AppBin -Filter *.dll -Recurse |
&{Process {
try {
$AssemblyInfo=[Reflection.AssemblyName]::GetAssemblyName($_.FullName)
$_ | Add-Member NoteProperty FileVersion ($_.VersionInfo.FileVersion)
$_ | Add-Member NoteProperty AssemblyVersion ($AssemblyInfo.Version)
$_ | Add-Member NoteProperty Flags ($AssemblyInfo.Flags)
$_ | Add-Member NoteProperty CultureName ($AssemblyInfo.CultureName)
$_ | Add-Member NoteProperty FullyQualifiedName ($AssemblyInfo.FullName)
$_ | Add-Member NoteProperty PublicKeyToken ($AssemblyInfo.GetPublicKeyToken())
} catch {},
$_
}} |
Select Name,FileVersion,AssemblyVersion ,Flags,CultureName,FullyQualifiedName,PublicKeyToken
# otherway around
$AppBin="c:\<appPath>\<bin>"
Get-ChildItem -Path $AppBin -Filter *.dll -Recurse | Select-Object Name
,@{n='FileVersion';e={$_.VersionInfo.FileVersion}}
,@{n='AssemblyVersion';e={[Reflection.AssemblyName]::GetAssemblyName($_.FullName).Version}}
,@{n='Flags';e={[Reflection.AssemblyName]::GetAssemblyName($_.FullName).Flags}}
,@{n='CultureName';e={[Reflection.AssemblyName]::GetAssemblyName($_.FullName).CultureName}}
,@{n='FullyQualifiedName';e={[Reflection.AssemblyName]::GetAssemblyName($_.FullName).FullName}}
,@{n='PublicKeyToken';e={[Reflection.AssemblyName]::GetAssemblyName($_.FullName).GetPublicKeyToken()}}
```
#### Get details of assemblies loaded in the current powershell session
```sh
[System.AppDomain]::CurrentDomain.GetAssemblies() |
Where-Object Location |
Sort-Object -Property FullName |
Select-Object -Property FullName
, Location
, GlobalAssemblyCache
, IsFullyTrusted |
Out-GridView
```
Azure Cloud Solution Architect, Full-Stack Development in .Net Eco system, Senior Manager at Capgemini
Thursday, July 27, 2023
Get assembly details using PowerShell
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment