Question

I've installed powershell v2 ctp3 from the ms download and was wondering where the usual reference assemblies are stored for use in c# for this version. I know for the v1 version they are in program file\etc\reference assemblies\powershell.... but where are they for the v2 ctp3 version. I specifically looking for the new System.Management.Automation.dll

regards Bob.

Was it helpful?

Solution

On my 32 bit XP system


Get-ChildItem \ -Recurse -Include System.Management.Automation.dll | 
 ForEach-Object {$.DirectoryName,$($.VersionInfo.FileVersion)}
reveals:


   C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0
6.0.6000.16386
C:\WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35
6.1.6949.0

Looking at the FileVersion reveals that the one in the GAC is the version you're looking for. But since it's in the GAC you don't need to worry about it, just reference it and than use it.

OTHER TIPS

In my case the path was in

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35

The way I found it was to see the updated folders after installing this ctp in Windows and see where the updates went. Hope this helps you.

You should not use the GAC to resolve references. You should find the appropriate references under something like: C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell

It is a common myth that assemblies are resolved at Design/Build time in the GAC. Prior to CLR 4.0, you got away with it (because 3.0 and 3.5 are really CLR 2.0). With true multi-targeting this breaks. As such, you should always use reference assemblies.

Also note that reference assemblies do not have to contain any code. They can just be the assembly meta-data and the public symbols.

Oh, and I meant to add, the GAC is used by the fusion load for Runtime resolution.

By Design/Build time, I mean at the time you are using Visual Studio to build your applicaiton, or are using MSBuild to build your EXE. During the build, we determine the references that are placed in the EXE. Since there may be multiple CLR's involved, we have to make sure the "right" ones are referenced.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top