开发者

FileNotFoundException when using Microsoft.VisualStudio.Coverage.Monitor.dll

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?


or one of its dependencies

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.


There are 4 references in this DLL (Here is what you find in ILDASM.exe):

.module extern **KERNEL32.dll**
.module extern **MSVCR100.dll**
.assembly extern **mscorlib**
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .hash = (AF 35 A4 2A B0 0E 9D FC 8A 27 B8 29 E5 56 7D 12   // .5.*.....'.).V}.
           18 84 3C 6B )                                     // ..<k
  .ver 4:0:0:0
}
.assembly extern **Microsoft.VisualC**
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .hash = (1B D7 52 11 F8 FD 90 65 01 8A 53 AA 7F 87 91 6D   // ..R....e..S....m
           F8 E3 72 91 )                                     // ..r.
  .ver 10:0:0:0
}

The first two are used as C DLL and the other two as .NET reference. Have a look to make sure you have Microsoft.Visual (in the GAC) and MSVCR100.dll (somewhere on your machine which is also a Path).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜