After upgrading to TypeMock 7.0 our build script fails to autodeploy/register TypeMock about 1/4 of the times. Rerunning the build fixes the issue, but it will fail again in a later build.
We autodeploy using the following msbuild script:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TypeMockLocation>C:BuildAgentworkbee78bdf3a3ba14WorkingDirSWrdPartyTypeMockin</TypeMockLocation>
</PropertyGroup>
<Import Project ="$(TypeMockLocation)TypeMock.MSBuild.Tasks"/>
<Target Name="RegisterTypeMock">
<TypeMockRegister Company ="OurCompany" License="OurLicenseKey" AutoDeploy="True"/>
</Target>
<Target Name="StartTypeMock">
<TypeMockStart/>
</Target>
<Target Name="UnRegisterTypeMock">
<TypeMockStop UnDeploy="True"/>
</Target>
</Project>
The error message when autodeploying is:
MockRegister.msbuild(8,10): error MSB4018: The "TypeMockRegister" task failed unexpectedly.
TypeMockRegister.msbuild(8,10): error MSB4018: System.OverflowException: Arithmetic operation resulted in an overflow.
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.Deploy.GACUtil.GetGACAssemblyPath(String assemblyName)
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.Deploy.AutoDeployTypeMock.RemoveGAC(Publish publisher, String assembly)
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.Deploy.AutoDeployTypeMock.DoGacInstall(Publish publisher, String interceptorsFilePath)
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.Deploy.AutoDeployTypeMock.Deploy(String rootDirectory)
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.CLI.Common.TypeMockRegisterInfo.Execute()
TypeMockRegister.msbuild(8,10): error MSB4018: at TypeMock.MSBuild.TypemockTaskBase.Execute()
TypeMockRegister.msbuild(8,10): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
TypeMockRegister.msbuild(8,10): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
TypeMockRegister.msbuild" (RegisterTypeMock target(s)) -- FAILED.