chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Up to now we have used TFS2012 based build process templates, but we are moving to the 2013 generation ones, tidying then as we go, just bring over the customisations we use.

An important one is Typemock using AutoDeployment. This has been working fine for our customised TFS2012 generation build process templates, we set the TypemockAutoDeployDir parameter in the TypemockSettings, pass this to the TypemockRegister activity and the required files are deployed to the build agent and my tests pass. Using TM 7.5.6.0 for a 2012 build template in the diagnostic log I see

Source AutoDeploy location is '$/BM/BuildProcessTemplates/TypemockAutoDeploy'
AutoDeploy translated to 'C:\B\63\122\Sources\TypemockAutoDeploy'
TypeMockRegister, Company='BlackMarble_5xDev', License='XXXXXXXX', AutoDeploy=True


All As I would expect, the source control $/ path is converted to a location on the agents working disk

However when I do the same with the 2013 version (only change is swapping to Typemock.TFS2013.DLL, we are on the same TFS 2013 build agents) in our 2013 generation build process template my TypemockRegister fails. This is what I have done
1. In the TFS build controllers customactivities folder (that is used by my build controller) place the files Configuration.dll, TypeMock.CLI.Common.dll, TypeMock.Integration.dll, Typemock.Interceptors.dll, TypeMock.TFS2013.dll (I also have the typemock.tfs2012.dll so my 2012 build process templates work as discussed above this is all working)
2. Put all the contents of the Typemock autodeployment folder (and sub folder) into source control (in a folder other than the customactivities one) - again this is the same folder that is being used by the 2012 build process template without error
3. In my build definition set the TypemockAutoDeployDir for the TypemockRegister activity (with the correct license keys)

When I run my build I get the error
Exception Message: Could not load file or assembly 'TypeMock, Version=7.5.6.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException) Exception Stack Trace: at TypeMock.CLI.Common.TypeMockStartInfo.Execute()

So it looks like I now need Typemock.dll in the same folder as the Typemock.TFS2013.dll

If I do this the typemock registration seems to work, but the log shows

Source AutoDeploy location is '$/BM/BuildProcessTemplates/TypemockAutoDeploy'
Setting deploy directory to: C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies
Typemock AppDomain base C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies
TypeMockRegister, Company='BlackMarble_5xDev', License=xxxx', AutoDeploy=True


So it knows about the $/ autodeployment folder, but has not done the translation to the local disk location as it used to for 2012. It is trying to use the main TFS custom build activities folder

The test then fail with

Exception Message: Exception has been thrown by the target of an invocation. (type TargetInvocationException)
Exception Stack Trace: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
Inner Exception Details:

Exception Message: *** Typemock Isolator Cannot be deployed, following file is required:
C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies\namespaces.dat
C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies\typemockconfig.xml
C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies\TypeMock.Configuration.exe
C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies\Typemock.ArrangeActAssert.dll
C:\Users\TFSBuild\AppData\Local\Temp\BuildAgent\63\Assemblies\Typemock.Isolator.VisualBasic.
....


I think confirming the runner is trying to use the customactivies folder and not the autodeployment one

I get the same issue if you use your provided TFS2012 (.12 version) template) so it is not my customisation.

If I drop all the contents of the typemock autodeployment folder into the customactivities folder all my tests work. So I do have a work around, but it is not a neat as your 2012 implementation

Is this a bug?

Richard
asked by rfennell (6.8k points)

5 Answers

0 votes
Hi Richard,

I experience exactly the same problem and have been in touch with Alex and Bar about the issue. They are working on it with high priority according to their latest reply here: https://www.typemock.com/answers/11567/

Best regards,

Robin Paardekam
answered by rpaardekam (9.6k points)
0 votes
Oops, should have done a better forum search first, I will keep my eye on both threads
answered by rfennell (6.8k points)
0 votes
Hi Richard,

We are working on it.
Ill keep you posted as soon as possible.
answered by Bar (3.6k points)
0 votes
Hi Richard and others,

I am still struggling with this workaround. I have been able to build successfully by placing the assemblies in the CustomActivities folder but I have several projects which use different TypeMock versions. As you might understand it is difficult to build all of those on the same machine with this workaround. I even tried to add a custom activity that adds the the correct files during the build, but the assemblies are all locked when the process is started so I can not even force an overwrite. I am stuck. How can I use the AutoDeploy feature whilst waiting for the next release? Any ideas that might be of help to me?

Thanks in advance.

Best Regards, Robin
answered by rpaardekam (9.6k points)
0 votes
Typemock 7 allows you to use older DLL versions in your projects (5.x or later) whilst running the tests via a newer version's runner. http://docs.typemock.com/isolator/Default.aspx##Ref.chm/Documentation/InstallingAutoDeploy.html

So what does this mean?

1. Put the current Typemock version on the build box via the autodeploy model
2. Leave your project using their older version of Typemock, but you do need them to reference the typemock DLLs from source control or Nuget, not by assuming they are already on the build box (see http://blogs.blackmarble.co.uk/blogs/rf ... ences.aspx)
3. Run the build and it should work OK

This is not dependant on a fix for this bug,
answered by rfennell (6.8k points)
...