Gacing .Net 2.0 DLLs using GACutil and PowerShell


Use the below snippet code to GAC .net 2.0 DLLs using Combination of GACutil and PowerShell.

$filepath=’D:\DLLS\’

$files=Get-ChildItem -Path $filepath -Recurse -filter *.dll

$gacUtilLocation = "D:\gacutil\gacutil.exe"; # give the GACutil exe Location

$files | foreach-object {

Write-Host “Adding” $_.FullName

$asm = [System.Reflection.Assembly]::LoadFile($_.FullName)

$command = “&`”{0}`”/nologo /i `”{1}`”” -f $gacUtilLocation,$_.FullName

invoke-expression $command

}

Regards,

Chaitanya

Leave a comment

Design a site like this with WordPress.com
Get started