0

I am making an application for migration working with Microsoft test manager and i have that exception

Could not load type 'Microsoft.TeamFoundation.TestManagement.Common.MaxLength' from assembly 'Microsoft.TeamFoundation.TestManagement.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

i added the right reference but still got that error can anyone help me please

user1666620
  • 4,800
  • 18
  • 27
k.diallo
  • 11
  • 5
  • Check if this assembly is in GAC (C -> Windows -> assemblies or use gacutil.exe). If it is not then check if it is copied to bin/Debug directory. You may want to set Copy True on assembly reference properties (just click on reference and navig to properties window). – csharpfolk Jun 21 '16 at 16:11
  • I check in my c->windows-> assembly and i the assembly Microsoft.TeamFoundation.TestManagement.Common, Version=10.0.0.0, so as you can see it is not the same version that i got in my reference. – k.diallo Jun 22 '16 at 12:47
  • when you say bin/debug directory you talking about my the folder generated in my visual studio project after the build thing ? – k.diallo Jun 22 '16 at 12:49
  • Exactly bin/Debug in your project directory – csharpfolk Jun 22 '16 at 13:00
  • also set copy true the reference properties for assembly. – k.diallo Jun 22 '16 at 13:11
  • But was this DLL in bin/Debug directory? And if it was, were version equal 14.0.0.0? – csharpfolk Jun 22 '16 at 13:21
  • I have done what you say but it's not work yet – k.diallo Jun 22 '16 at 13:23
  • You still don't *write* in the comments if DLL was in Debug directory, if you answer this question it will help me know what may be wrong... – csharpfolk Jun 22 '16 at 13:28
  • The simple solution will be to downgrade to version 10.0.0.0 by changing referenced assembly in your project. Other solution is to use rebinding to load older version described here: http://stackoverflow.com/questions/17092928/assembly-binding-redirect-to-a-lower-version The last but the best solution is to find version 14 and install it in GAC or deploy it with your application – csharpfolk Jun 22 '16 at 13:30
  • Yup! this dll is in bin/Debug directory and the version equal 14.0.0.0 – k.diallo Jun 22 '16 at 13:34
  • i can't downgrade to version 10.0.0.0 because my constructor use that version and if i do that i got another error there. – k.diallo Jun 22 '16 at 13:48
  • how can i do the last solution you suggested ? where can i find the version 14 and how install it in GAC or deploy it with your applicatio? – k.diallo Jun 22 '16 at 13:50
  • OK, I see if DLL is in `bin/Debug` system should load it. So the problem may be that this `MaxLenght` type was removed in newer version. You may use ILSpy or other decompiler to load `Microsoft.TeamFoundation.TestManagement.Common` and check if `MaxLength` is declared in that DLL. – csharpfolk Jun 22 '16 at 14:08
  • Look at these 2 MSDN pages: https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.testmanagement.common(v=vs.100).aspx and https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.testmanagement.common(v=vs.140).aspx looks like MaxLength class was removed after release of Visual Studio 2012 – csharpfolk Jun 22 '16 at 14:16
  • you're right! do you think it is a good idea to add that class to the version 14.0.0.0 – k.diallo Jun 22 '16 at 16:02
  • You cannot do that, this assembly is part of Visual Studio/TFS. You may try to google if this class was moved to another assembly or if there is workaround, maybe you should check where MaxLength was used in your code and remove/change that? – csharpfolk Jun 22 '16 at 17:21

0 Answers0