V
Varun Bansal
Hi,
I was trying to compile the following sample code from MSDN
using System;
using System.Collections;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Host;
using System.Management.Automation.Runspaces;
namespace Microsoft.Samples.Msh.Host
{
class Runspace01
{
static void Main(string[] args)
{
RunspaceInvoke invoker = new RunspaceInvoke();
Console.WriteLine("Process HandleCount");
Console.WriteLine("--------------------------------");
foreach (MshObject result in invoker.Invoke("get-process"))
{
Console.WriteLine("{0,-20} {1}",
result.Members["ProcessName"].Value,
result.Members["HandleCount"].Value);
}
System.Console.WriteLine("Hit any key to exit...");
System.Console.ReadKey();
}
}
}
And I'm getting the following error -
The type or namespace name 'Generic' does not exist in the class or
namespace 'System.Collections' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
I installed the latest .net 2.0 framework. When I try to add the reference
of System.Management.Automation.dll in VS2k3 .net, it does not allow me to
add saying that it is not a valid dll. Am I missing something? I'm new to
..NET. Please help.
Thanks,
Varun
I was trying to compile the following sample code from MSDN
using System;
using System.Collections;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Host;
using System.Management.Automation.Runspaces;
namespace Microsoft.Samples.Msh.Host
{
class Runspace01
{
static void Main(string[] args)
{
RunspaceInvoke invoker = new RunspaceInvoke();
Console.WriteLine("Process HandleCount");
Console.WriteLine("--------------------------------");
foreach (MshObject result in invoker.Invoke("get-process"))
{
Console.WriteLine("{0,-20} {1}",
result.Members["ProcessName"].Value,
result.Members["HandleCount"].Value);
}
System.Console.WriteLine("Hit any key to exit...");
System.Console.ReadKey();
}
}
}
And I'm getting the following error -
The type or namespace name 'Generic' does not exist in the class or
namespace 'System.Collections' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
The type or namespace name 'Automation' does not exist in the class or
namespace 'System.Management' (are you missing an assembly reference?)
I installed the latest .net 2.0 framework. When I try to add the reference
of System.Management.Automation.dll in VS2k3 .net, it does not allow me to
add saying that it is not a valid dll. Am I missing something? I'm new to
..NET. Please help.
Thanks,
Varun