title: How can I make Code Contracts ignore a specific assembly reference?
body: <p>I'm making an extension to Visual Studio. Within the code I'm using Code Contracts to make assertions and checks. I set the warning option level to high.</p>
  
  <p>What I would like to do is maintain that warning level while ignoring any checks made on EnvDTE references.</p>
  
  <p>Consider the following code example:</p>
  
  <pre><code>public static string GetAbsoluteOutputFolder(EnvDTE.Project project)
  {
      if (project == null) throw new ArgumentNullException("project");
  
      var path =
          project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString();
      //...
  }
  </code></pre>
  
  <p>With my current settings, CC would require me to add the following checks before assigning the <code>path</code> variable:</p>
  
  <pre><code>Contract.Assume(project.ConfigurationManager != null);
  Contract.Assume(project.ConfigurationManager.ActiveConfiguration != null);
  Contract.Assume(project.ConfigurationManager.ActiveConfiguration.Properties != null);
  </code></pre>
  
  <p>Therefore what I'd like to do here is to tell CC to "trust" EnvDTE and ignore these types and their properties.</p>
  
  <p>I thought the "Be optimistic on external API" CC option served this very purpose; turns out it doesn't.</p>
  
  <p>Is there a way to make it behave the way I want <strong>that would not require a lower warning level</strong>?</p>
  
  <p><strong>EDIT:</strong> I want a solution that would work at project level and that would still allow "regular" checks to be performed.</p>