"ManagementScope " could not be found

3.8k Views Asked by At

I'm getting this error:

CS0246: The type or namespace name 'ManagementScope' could not be found...

On this line:

private ManagementScope plainScope = null;

The project builds fine, however I get the above compiler error during runtime when I try to load any page. Yes, I have the appropriate using System.Management statement. Yes, I have included System.Management as a reference. This is my using statement block:

using System;
using System.Collections.Generic;
using System.Data;
using System.Management;

I have read this question, and my project is targeting the .Net 3.5 Framework, not 4. In case it helps, the offending code is inside a class file which is included in the App_Code directory of the project. The "Build Action", under Advanced Properties of the file is set to "Compile". I believe that this might have something to do with the problem seeing as I was using the System.Management namespace recently in the code-behind of an aspx file and it compiled and ran just fine.

2

There are 2 best solutions below

0
On BEST ANSWER

Have you considered using fusion?

This tool will log all attempts to load assemblies made by the .Net framework... It shows exactly what file it was looking for and where it tried looking for it.

NB: You need to run it as an administrator to be able to change logging settings. The Log location it prompt for should point at an empty directory if you want to set it manually

1
On

you need to add System.Management in the projects references