PowerShell: Accessing static member in PowerShell Script
Recently I created NuGet package which auto upgrade ASP.NET MVC 3 application to MVC 4 and while I was creating this package I worked with powershell. Before that I never worked with powershell so I learned a few thing so thought to share it with reader. If you are new to powershell then you can execute powershell script with command prompt or if you are GUI inclined then Windows 7 also have PowerShell ISE (Integrated Scripting Environment).
To open command prompt type powershell in Run window and press enter or search for powershell in Start all programs and open powershell ISE.
In PowerShell ISE we can see two pane Command Pane & Output Pane. Both pane names are self explanatory so I'm leaving it upto you ;) But yes in command window we can fire any command which we can fire in Windows Command Prompt.
Accessing Static Member
Sometime we need to access static member from powershell script as I required it while creating this NuGet package. So in powershell, we can access static member with Scope Resolution Operator (::). For e.g. type following command in powershell command pane
Upon hitting enter in command prompt we can see output in output pane
So in powershell we can access static member with the help of Scope Resolution Operator (::). Hope this would be helpful!
You can follow me on twitter for latest link and update on ASP.NET & MVC.