I wanted to deploy an assembly to the Global Assembly Cache (GAC) on a Windows 2008 server - GacUtil isn't neccessary installed, and I don't really want to install the entire SDK on to the server just to get it.
PowerShell to the rescue!
The first thing I needed to do was enable PowerShell to load .Net 4 assemblies, this was done by adding a config file into the PowerShell home directory (run
$pshome from a PowerShell console), with the following contents:
<supportedruntime version="v4.0.30319" />
<supportedruntime version="v2.0.50727" />
You can then run the following commands to load the 4.0 instance of EnterpriseServices, which will install your libraries into the correct GAC depending on it's target runtime:
$publish = New-Object System.EnterpriseServices.Internal.Publish
Filed under: .Net, Fixes