Building a Snap-in Targeting PowerShell V1 and PowerShell V2


How do I build a PowerShell snap-in to target PowerShell v1 and v2? Given that v1 and v2 can't be installed side by side how can I reference the appropriate assemblies and build against them?

Inevitably as things go on I'm going to be adding new PowerShell v2 specific features. So I'm going to need separate product builds targeting different versions of PowerShell.

We do that with the PowerShell Community Extensions 1.2. We just reference the PowerShell 1.0 version of System.Management.Automation but AFAICT there is only a 1.0 version of this assembly. Anyway, the snapin loads and runs fine in both PowerShell 1.0 and 2.0.

This video can help you solving your question :)
By: admin