title: "Failed to set up execution context" when running VC++ unit test with external dependencies
body: <p>I have a solution (available on Git at <a href="https://github.com/andry-tino/code-alive/tree/master/src/triangulator/src" rel="noreferrer">this link</a>) including one project (producing a DLL library) and a native unit test.</p>
  
  <ul>
  <li>Visual Studio Enterprise 2015 with VC++</li>
  <li>On Windows 10</li>
  </ul>
  
  <p>The structure of my solution is the following:</p>
  
  <pre><code>./src
  +--DelaunayTriangulator.UnitTest
  |  |--DelaunayTriangulatorTest.cpp
  |  |--DelaunayTriangulator.UnitTest.vcxproj
  +--DelaunayTriangulator
  |  |--DelaunayTriangulator.cpp
  |  |--DelaunayTriangulator.h
  |  |--DelaunayTriangulator.vcxproj
  |--Triangulator.sln
  </code></pre>
  
  <h3>The project</h3>
  
  <p>My source project works and builds fine. It links some libs (AFAIK, they are basically static libraries) which are just some <a href="https://www.cgal.org/" rel="noreferrer">CGAL</a> stuff I need as dependencies. It also runs fine.</p>
  
  <p>If you have a look at the <a href="https://github.com/andry-tino/code-alive/blob/master/src/triangulator/src/DelaunayTriangulator/DelaunayTriangulator.vcxproj" rel="noreferrer">project</a>, you will find that I link those <code>.lib</code> files as part of Linker options:</p>
  
  <pre><code>&lt;Link&gt;
        &lt;AdditionalDependencies&gt;$(CGALDirPath)\build\lib\Debug\CGAL-vc140-mt-gd-4.12.lib;$(CGALDirPath)\auxiliary\gmp\lib\libgmp-10.lib;$(CGALDirPath)\auxiliary\gmp\lib\libmpfr-4.lib;..&lt;/AdditionalDependencies&gt;
        ...
  &lt;/Link&gt;
  </code></pre>
  
  <h3>The test project</h3>
  
  <p>The unit test project has been created by using the <a href="https://msdn.microsoft.com/en-us/library/hh598953.aspx" rel="noreferrer">native test project</a> walkthrough and template in Visual Studio. The <a href="https://github.com/andry-tino/code-alive/blob/master/src/triangulator/src/DelaunayTriangulator.UnitTest/DelaunayTriangulator.UnitTest.vcxproj" rel="noreferrer">test project</a> is also linking the same <code>.lib</code> files that the source project does. Following is the single test I have:</p>
  
  <pre><code>#include "stdafx.h"
  #include "CppUnitTest.h"
  
  #include "../DelaunayTriangulator/DelaunayTriangulator.h"
  
  using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  using namespace CodeAlive::Triangulation;
  
  namespace TriangulatorUnitTest {
      TEST_CLASS(DelaunayTriangulatorTest) {
  
      public:
          TEST_METHOD(PerformTriangulation) {
              DelaunayTriangulator* triangulator = new DelaunayTriangulator();
              int result = triangulator-&gt;Perform();
  
              Assert::AreEqual&lt;int&gt;(0, result, L"Wrong result", LINE_INFO());
  
              delete triangulator;
          }
      }; // class
  } // ns
  </code></pre>
  
  <p>Before I linked those <code>.lib</code> files from CGAL, the project did build but did NOT run at all, showing this error message:</p>
  
  <blockquote>
    <p>Message: Failed to set up the execution context to run the test</p>
  </blockquote>
  
  <h3>The error</h3>
  
  <p>As soon as I added the <code>.lib</code> files, the project did build and the single unit test did run only if I left the <code>Assert</code> line uncommented (I had to comment all the code referencing my source project):</p>
  
  <pre><code>TEST_CLASS(DelaunayTriangulatorTest) {
  public:
      TEST_METHOD(PerformTriangulation) {
          Assert::AreEqual&lt;int&gt;(0, 0, L"Wrong result", LINE_INFO());
      }
  };
  </code></pre>
  
  <p>When I uncomment the code referencing my project (using the classes I define in my source project), then the same error message shows up when I try running the test:</p>
  
  <pre><code>TEST_CLASS(DelaunayTriangulatorTest) {
  public:
      TEST_METHOD(PerformTriangulation) {
          DelaunayTriangulator* triangulator = new DelaunayTriangulator();
          int result = triangulator-&gt;Perform();
  
          Assert::AreEqual&lt;int&gt;(0, result, L"Wrong result", LINE_INFO());
  
          delete triangulator;
      }
  };
  </code></pre>
  
  <p>I understand that this is due to some kind of issue with external references. What is wrong here? </p>