none
having trouble calling System.Management

    Question

  • Hi, I use the Viusal C# Express edition. As far as I know the 2005 version that I am using is based on .Net 2.0, so it should have the System.Management namespace. However, I can't use that namespace... There is no intellisense or anything that popos up after I type it out... Do I need to have a server version of the OS to have System.Management?

    Thanks,
    Ke
    Friday, February 16, 2007 8:08 PM

Answers

  • Then there's something really wrong with your installation. Try reinstalling it, including the .NET framework.
    Monday, February 19, 2007 1:10 PM
  • Thanks for all the advice.

    I find that it's actually working fine on my XP SP2 PC at work... the one at home I am running Vista. I think it must be some compatibility issue of VS Express with Vista then... even though I installed SP1 for VS Express.

    Thanks for your time.
    Ke

    Monday, February 19, 2007 3:52 PM

All replies

  • It's also available in the express edition, just like any other namespace in the framework. Maybe you forgot to add the System.Management.dll in your reference list.
    Friday, February 16, 2007 10:07 PM
  • Hmm... I added in the dll manually... but still won't work.

    If I try to compile it would say:

    Error 1 The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Users\Ke\AppData\Local\Temporary Projects\WindowsApplication1\Form1.cs 8 14 WindowsApplication1

    With the code like this below:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using System.Management;

    namespace WindowsApplication1

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void button1_Click(object sender, EventArgs e)

    {

    }

    }

    }


    You can see I really didn't change anything from the easiest example. And this is a new machine I just setup with Visual C# express edition. Please help!

    Ke

     

    Sunday, February 18, 2007 2:02 AM
  • Are you sure you added the dll to your references? I'm not talking about the using statement in your code but about the references list in the solution explorer.
    Monday, February 19, 2007 9:40 AM
  • Yes, I added in from solutions explorer.
    Monday, February 19, 2007 12:55 PM
  • Then there's something really wrong with your installation. Try reinstalling it, including the .NET framework.
    Monday, February 19, 2007 1:10 PM
  • Thanks for all the advice.

    I find that it's actually working fine on my XP SP2 PC at work... the one at home I am running Vista. I think it must be some compatibility issue of VS Express with Vista then... even though I installed SP1 for VS Express.

    Thanks for your time.
    Ke

    Monday, February 19, 2007 3:52 PM