Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try adding your C++ project reference to the C# project <strong>after</strong> cleaning the solution. This works for me, although I stumbled on this "workaround" by pure chance.</p> <p>To me it looks as if Visual Studio is checking the build product of the referenced project, and when it notices the incompatibility it will refuse to add the reference. If, however, the build product is not around to check (because you cleaned the solution), Visual Studio happily adds the reference.</p> <p>I tested the resulting solution both in Visual Studio and on our TFS build server (which AFAIK uses <code>MSBuild</code>) and build dependencies were evaluated correctly in both cases.</p> <p>In your question you also mention that manually editing the <code>.csproj</code> file didn't help. I cannot confirm this. I was able to add the following reference and again got a positive build result:</p> <pre><code>&lt;ProjectReference Include="..\Foo\Foo.vcxproj"&gt; &lt;Name&gt;Foo&lt;/Name&gt; &lt;ReferenceOutputAssembly&gt;false&lt;/ReferenceOutputAssembly&gt; &lt;Private&gt;False&lt;/Private&gt; &lt;/ProjectReference&gt; </code></pre> <p>I am adding the <code>ReferenceOutputAssembly</code> element because <a href="http://blogs.msdn.com/b/visualstudio/archive/2010/12/21/incorrect-solution-build-ordering-when-using-msbuild-exe.aspx">this blogs.msdn.com article</a> suggests it. In my experience, though, the build also works without the element. The article is still worth reading because it explains <em>why</em> <code>MSBuild</code> does not honor dependencies defined in the solution.</p> <p>For completeness sake: I am running Visual Studio 2010, Version <code>10.0.40219.1 SP1Rel</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload