Can’t implement VSProject
< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Hello, I trying to create some mock objects for unit tests that implement the VSProject interface. I created a class and implemented the interface, everything compiles but one I try to instantiate my mock class (new MockVSProject()) I get:
System.TypeLoadException: Method 'get_DTE' in type 'MyLibrary.MockVSProject' from assembly ' MyLibrary.Mocks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation..
Any idea of what the problem could be
Thanks
Gabo

Can't implement VSProject interface
Chris Sells
fpalang
Wow!, I would have never figured out this one. I added an App.config to my Unit Tests project with the bindingredirect and everything works now.
Thanks a lot!.
Gabo
bikeman123
I have a similer looking problem with my language package. When I use Regpkg.exe /codebase mylangpackage.dll, I get errors stating 'Could not load file 'EnvDTE version7.0.3333.0...........'
So I looked up to find out that the VSLangProj.dll refers to the old version of EnvDTE which is 7.0.3333.0
I again found out about the binding redirect solution, so I created a Regpkg.exe.config and put the <runtime>bindingredirect xml here</runtime> in it. It still didn't work for me after this. I am wondering how I can resolve this.
Then I installed the actual EnvDTE 7.0.3333.0 version into GAC (I picked this up from elsewhere, coz I didn't have it in my machine. I have EnvDTE version 8.0.0.0)
Now when I run Regpkg.exe /codebase mylangpackage.dll, I get this error Method 'get_DTE' in type 'Microsoft.VisualStudio.Package.Automation.OAReferenceBase`1' from assembly 'mylangaugepackage.dll'
Any help is appreciated.
Thanks in advance,
AMD
I think the testing tools work from a seperate process, and not inproc, from the code being tested, is this correct If so, then you need to create or modify a .config file for the testing process and add a binding redirect for the EnvDTE PIA. You can see an example of how this is done from devenv.exe.config, where we have this redirect.
We changed the version number of the EnvDTE PIA, but did not rebuild VSLangPro.dll. So VSLangProj references a PIA that no longer is on disk, and so the binding redirect causes the new, correct version to be loaded.
Craig
goke
It seems like it, however, I implemented the whole set of methods defined by the VSProject interface (using Visual Studio->implement interface).
Also, If I was be missing a method implementation, then it wouldn't compile at all. There's something obscure about VSProject that I can't figure out. (if I create my mock class in a Unit Test project, then MSTest can't start at all).
Thanks anyway.
Gabo