This error happens randomly, but on average about every 10-15 builds.
We looked through Process Explorer and the TFS Build Agent itself (TFSBuildServiceHost.exe), not a child process, held the reference to ProfileLinker.dll.
Our custom template is based off of the DefaultTemplate.11.1.WithTypemock. We added some customizations: variables for directory names and XML PreProcess. I have attached the file.
In the build prior to the error, we saw that the TypeMockStop activity was successfully executed.
Here are the details of the activities from the build prior to the error (with Company and License masked):
TypeMockRegister00:00:05
Inputs
License: XXXX-XXXX-XXXX-XXXX-XXXX
Company: XXXXXXXX
AutoDeployDir: $/XXXX/SharedLibs/Typemock
Outputs
AutoDeployDir: $/XXXX/SharedLibs/Typemock
Source AutoDeploy location is '$/XXXX/SharedLibs/Typemock'
AutoDeploy translated to 'C:XXXXSharedLibsTypemock'
Typemock AppDomain base C:XXXXSharedLibsTypemock
TypeMockRegister, Company='xxxxxxxx', License='XXXX-XXXX-XXXX-XXXX-XXXX', AutoDeploy=True
TypeMockStart00:00:00
Inputs
Verbosity: Normal
Target:
ProfilerLaunchedFirst: False
Link:
EvaluationFolder:
LogPath:
AutoDeployDir:
LogLevel: 0
Outputs
Version:
LogPath:
AutoDeployDir:
LogLevel: 0
Leaving AutoDeploy location as is
Setting deploy directory to: C:UsersYYYYAppDataLocalTempBuildAgentAssemblies
Typemock AppDomain base C:UsersYYYYAppDataLocalTempBuildAgentAssemblies
TypeMockStart Target=, ProfilerLaunchedFirst=False, Link=, LogLevel=0, LogPath=, EvaluationFolder=
TypeMockStop00:00:00
Inputs
Undeploy: True
AutoDeployDir:
Outputs
AutoDeployDir:
Leaving AutoDeploy location as is
Setting deploy directory to: C:UsersYYYYAppDataLocalTempBuildAgentAssemblies
Typemock AppDomain base C:UsersYYYYAppDataLocalTempBuildAgentAssemblies
TypeMockStop - Undeploy = True
Thank you for your time.
Note: I forgot to mention in my original post that we are running TypeMock Isolator version 7.4.2
CstProcessTemplatev1.xaml.txt (Build Process Template being used.)