Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / April 2006

Tip: Looking for answers? Try searching our database.

Compilation error - missing assembly or reference

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Varun Bansal - 26 Apr 2006 16:12 GMT
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
Varun Bansal - 26 Apr 2006 16:46 GMT
Oh Sorry - it was using System.Collections.Generic on the second line and
not using System.Collections.
I cannot find using System.Collections.Generic namespace in
System.Collections.

Varun

> Hi,
>
[quoted text clipped - 45 lines]
> Thanks,
> Varun
Chris Chilvers - 29 Apr 2006 16:34 GMT
Mattias Sjögren - 26 Apr 2006 17:39 GMT
>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.

VS 2003 only supports version 1.1 of the framework. To reference 2.0
assemblies you need VS 2005.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Varun Bansal - 26 Apr 2006 18:51 GMT
Thanks Mattias for the prompt reply. It worked !

Varun

>>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
[quoted text clipped - 5 lines]
>
> Mattias

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.