title: Incompatible Reference: System.Management 4.0.0.0?
body: <p>I created a C# 4.0 Console application. The target framework is .Net Framework 4 Client profile. I want to count the number of cores in my cpu. To do this I created the following class:</p>
  
  <pre><code>internal class MultiThreading
  {
      public int GetNumberOfCores()
      {
          var coreCount = 0;
          foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
              coreCount += int.Parse(item["NumberOfCores"].ToString());
  
          return coreCount;
      }
  }
  </code></pre>
  
  <p>For this code to work, it needs a reference to System.Management. To do this in the solution explorer I right clicked my project references->Add reference. A dialog window opens and allows me to select System.Management version 4.0.0.0. The dialog window shows that I am using the 4.0 Framework. So far so good. I click "Add" and I get the following message:</p>
  
  <blockquote>
    <p>"System.Management, Version 4.0.0.0, Culture=neutral, PublicKeyToken = b034543655555" is incompatible with .Net Framework 4 Client Profile    In order to add it you should change >the project's target to a compatible framework first.</p>
  </blockquote>
  
  <p>As a sanity check I went here: <a href="http://msdn.microsoft.com/en-us/library/system.management.managementobjectsearcher.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.management.managementobjectsearcher.aspx</a></p>
  
  <p>...and msdn clearly states that System.Management 4.0.0.0 is compatible with .Net Framework 4 Client Profile.</p>
  
  <p>Can anyone assist?</p>