title: How do I embed StyleCop in the solution?
body: <p>I try to integrate StyleCop in a Visual Studio solution. Installing StyleCop on each machine of each developer is something I would prefer to avoid. The suggestion I've seen several times (<a href="http://blogs.msdn.com/b/sourceanalysis/archive/2008/05/24/source-analysis-msbuild-integration.aspx" rel="noreferrer">example</a>) is to include the binaries of StyleCop within the project, storing them in version control.</p>
  
  <p>I did that. It <em>works on my machine</em>, but fails on a different machine where StyleCop is not installed. After uninstalling StyleCop on my machine, it doesn't work there either.</p>
  
  <p>The error message is the following:</p>
  
  <blockquote>
    <p>Severity  Code    Description Project File    Line
    Error       The "StyleCopTask" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild..\StyleCop 4.7\StyleCop.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\StyleCop 4.7\StyleCop.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the  declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.  Demo</p>
  </blockquote>
  
  <p>This is what I included in every .csproj file:</p>
  
  <pre><code>&lt;Import Project="$(SolutionDir)\externs\Microsoft.StyleCop\StyleCop.targets" /&gt;
  </code></pre>
  
  <p>The directory <code>C:\demo\externs\Microsoft.StyleCop</code> contains:</p>
  
  <ul>
  <li><p>The copy of all the files from <code>C:\Program Files (x86)\StyleCop 4.7</code>,</p></li>
  <li><p>The copy of <code>C:\Program Files (x86)\MSBuild\StyleCop\v4.7\StyleCop.Targets</code>.</p></li>
  </ul>
  
  <p>What's wrong?</p>