C# console app with a reference to c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\DataCollectors\x86\Microsoft.VisualStudio.Coverage.Monitor.dll:
using Microsoft.VisualStudio.CodeCoverage;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Monitor m = new Monitor();
}
}
}
The object creation line throws a FileNotFoundException with the message Could not load file or assembly 'Microsoft.VisualStudio.Coverage.Monitor.dll' or one of its dependencies. The specified module could not be found.
Any idea why is this happening and how can be fixed?
Which is the relevant part of the error message. It has a dependency on vspmsg.dll from that same directory, you’ll have to copy it by hand into your bin\Debug folder. Using private assemblies, exclusive to Visual Studio, is fairly courageous.