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
0 votes

I am trying to runn Typemock from finalbuilder without installing typemock.

I have run an msbuild autodeploy task, but when running TMockRunner in Finalbuilder i get the following error:

Executing : C:FinalBuilderWorkingFolderVaultSWrdPartyTypeMockinTMockRunner.exe
With Command Line : -link none "C:FinalBuilderWorkingFolderVaultSWrdPartyMbUnitinMbUnit.Cons.exe" /report-name-format:Test.dll /report-folder:../UnitTestLogs /report-type:xml /filter-category:UnitTest Test.dll

Unhandled Exception: System.BadImageFormatException: The format of the file 'TypeMock' is invalid.
File name: "TypeMock"
at e.a(String[] A_0)

=== Pre-bind state information ===
LOG: DisplayName = TypeMock, Version=, Culture=neutral, PublicKeyToken=3dae460033b8d8e2
LOG: Appbase = C:FinalBuilderWorkingFolderVaultSWrdPartyTypeMockin
LOG: Initial PrivatePath = NULL
Calling assembly : TMockRunner, Version=, Culture=neutral, PublicKeyToken=null.

LOG: Private path hint found in configuration file: PrivateAssemblies.
LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from C:WINDOWSMicrosoft.NETFramework1.1.4322configmachine.config.
LOG: Post-policy reference: TypeMock, Version=, Culture=neutral, PublicKeyToken=3dae460033b8d8e2
LOG: Attempting download of new URL file:///C:/FinalBuilder/WorkingFolder/Vault/SW/3rdParty/TypeMock/bin/TypeMock.DLL.

Program returned code : -532459699
asked by Findulias (1.8k points)

8 Answers

0 votes

It looks like you are trying to run the incorrect version of Typemock, for the test assemblies you are running.
You can specify which version you want TMockRunner to link with using the -target parameter.

TMockRunner -target 1.1 "C:FinalBuilderWorkingFolderVaultSWrdPartyMbUnitinMbUnit.Cons.exe" /report-name-format:Test.dll /report-folder:../UnitTestLogs /report-type:xml /filter-category:UnitTest Test.dll 

Or for 2.0:
TMockRunner -target 2.0 "C:FinalBuilderWorkingFolderVaultSWrdPartyMbUnitinMbUnit.Cons.exe" /report-name-format:Test.dll /report-folder:../UnitTestLogs /report-type:xml /filter-category:UnitTest Test.dll 

If you are not linking to any profiler, you can drop the "-link none" parameters.

Let me know if this works for you.
Let me
answered by gilz (14.5k points)
0 votes
I tried removing -link none and added -target 2.0 , but it did not help.
I get the same error and still it refers to 1.1 framework
I am doing this in a virtual machine.
(.net Framework 2.0 is installed)
answered by Findulias (1.8k points)
0 votes

It looks like finalbuilder is finding the .NET 1.1 version of typemock.dll.

If you have not installed typemock on that machine it should be there in the first place. Can you check what is the actual version of typemock.dll that is brought by the autodeploy script?

If its the correct version, try to search and delete all other versions of typemock.dll on that machine.

:!: Im assuming that typemock is not installed on this machine.
answered by lior (13.2k points)
0 votes
Searched for TypeMock.dll, and found only version
Typemock is not installed.

My msbuildfile for deploying typemock is:
<Project xmlns="">
<Import Project ="$(TypeMockLocation)TypeMock.MSBuild.Tasks"/>

<Target Name="RegisterTypeMock">
<TypeMockRegister Company ="XXXXXX" License="XXXXXXXX" AutoDeploy="True"/>

<Target Name="UnRegisterTypeMock">
<TypeMockStop UnDeploy="True"/>

In Finalbuilder I first auto-deploy typemock then I compile and runs the unittests.

I get no error when deploying TypeMock, it says auto-deployed

And at the end of my build script i run the msbuild UnRegisterTypeMock
answered by Findulias (1.8k points)
0 votes

Can you look at the CLR version of the dll you found?
Since this is the only dll present, most likely its the .net 1.1 version of typemock.dll.

If that is the case you will need to copy the correct Typemock.dll from an installed machine. The .net 2.0 version of typemock.dll is found in the main installation dir. (C:Program FilesTypeMockTypemock.NET)

If you can please let me know if this works.
:?: you are trying to run under the .NET 2.0?

:!: The msbuild file is not actually in charge of copying the files to the build machine. This is done externally (usually manually or by the source control).
answered by lior (13.2k points)
0 votes

how do I find out what CLR version is used?

If I open up properties on the dll The file/assenbly version says
And in the description field it says TypeMock.NET for .NET 2.0

Yes I know that the msbuild is not resposible for the copy of the dll, finalbuilder gets that from our sourcecontrol system.
answered by Findulias (1.8k points)
0 votes
Lets take it offline.

The error that youre getting indicate a mismatching typemock version. and we will need to figure out from the logs what exactly goes on there.

I will send you an email with details on how to produce the logs so you can send them to us.

(it is worth making sure that in your projects you are referencing the .net 2.0 version of typemock.dll)
answered by lior (13.2k points)
0 votes
My project refers to typemock

(Updated my profile to show my email)
answered by Findulias (1.8k points)