This project is read-only.

TransMock generated .cs file does not appear to be generated

Feb 21 at 2:56 PM

I am looking at implementing running unit tests for our BizTalk applications.
A key step is to be able to mock the BizTalk application ports.

I am using TransMock to do this but I have a number of teething problems with getting it working.

The file that should be generated by the Mockifier is not being generated. I have checked the project location that I set in my BSP.Systems.X5.Costings.Deployment.btdfproj which is:

I have searched my C: drive and I am sure that the file is not created.

I am following the steps in this blog.

The steps I have taken are:
I have defined these properties as the first properties in the first property group in the BSP.Systems.X5.Costings.Deployment.btdfproj file as:
I have defined this import as the import in the BSP.Systems.X5.Costings.Deployment.btdfproj
<Import Project="C:\Program Files (x86)\TransMock\BTS2013R2\Ext\TransMock.targets"/>

I have installed TransMock in directory
C:\Program Files (x86)\TransMock

At this point I rebuild and deploy my BizTalk application which builds and deploys fine.
But the .cs file that I am expecting to be generated by Mockifier does not appear to be generated.

The environment I am running is:
TransMock v1.2.0.0
Windows server 2008
BizTalk 2010
Visual Studio 2010 premium
This environment is running on an Oracle VBox VM.

I am sure I have just missed a step or something like that.

Please could someone tell me if the best way to diagnose this.

Many thanks,

Feb 22 at 10:33 PM
Hi Geoff, thanks for highlighting this issue. May I ask you for the logs of your BTDF deployment, specifically the part that is about invoking the mockifier? If you are using the BTDF add-in in VS you can get hold of these very easy - from the output window in VS. Look for the appearace of the work mock and copy the entire section that is under CustomDeployTarget. Post this log here so we take it from there.

Feb 27 at 10:38 AM

I have just installed the latest version and there is an issue with the installed folder being ..\BTS2013R2 to get round this I have done the following

1) renamed the install folder to ..\BTS2013
2) altered the import targets file to C:\Program Files (x86)\TransMock\BTS2013\Ext\TransMock.targets

This solved the issue and the .cs file is now being created in the ..\Deployment folder.

I think the above post could be the same issue.

Feb 28 at 8:59 PM
Hi Jim and thank you for letting me now about this issue. I will have a look at this and solve it shortly.

In the meanwhile I will be releasing soon a version that is deployable through Nuget, where the targets would be referenced from the packages folder. Will be much more hahdy apposed to the current model. Will keep the MSIs for a while, but Nuget will be the preferred way going forward.

@Geoff - could you be so kind and report if the steps described by Jim are solving your issue?

Cheers, Svetoslav
Mar 1 at 2:29 PM
Hi Svetoslav

Thanks for your help but I have not managed to resolve by using Jim's solution.
I have included the deployment log, sorry its so long but I could not see any reference to the word 'mock'.
Below that are the first few lines and the last few lines of my btdfproj file showing the <BTSVersion>2010</BTSVersion> setting and the import of the transmock.targets.

Many thanks for your help,

Build started 01/03/2017 13:30:05.
Project "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings.Deployment.btdfproj" (default targets):

Target Deploy:
    Target ServerDeploy:
        Target DeployBizTalkMgmtDB_true:
            Target SetWinVer:
                Running on Windows V61
                Detected IIS 7
                Detected 64-bit OS
            Target GetSoftwarePaths:
                Using .NET Framework Install Path 'C:\Windows\Microsoft.NET\Framework\v2.0.50727'.
                Using BizTalk Install Path 'C:\Program Files (x86)\Microsoft BizTalk Server 2010\'.
                Using Deployment Framework Install Path 'C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\'.
                Using Deployment Framework Tools Path 'C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\Framework\DeployTools'.
                Using BizTalk ESB Toolkit Install Path 'C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\'.
            Target ExportSettings:
                Skipping settings file export because file at SettingsSpreadsheetPath does not exist: C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\EnvironmentSettings\SettingsFileGenerator.xml
            Target InitializeAppName:
                BizTalk Application Name is BSP.Systems.X5.Costings
            Target InitSettingsFilePath:
                Using settings file
            Target PreprocessBindings:
                Clearing file attributes for 'PortBindings.xml'.
                "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\Framework\DeployTools\xmlpreprocess.exe" /f /v /c /i:"C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings.BindingInfo.xml" /o:"C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\PortBindings.xml" /d:CurDir="C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0" /s:""
                Processing the file: C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings.BindingInfo.xml
                Using settings from:
                Produced file:C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\PortBindings.xml
            Target DeployFileAdapterPhysicalPaths:
                The BTSACCOUNT environment variable must be set up in InstallWizard.xml for automatic configuration of permissions for FILE adapter physical paths.
                Configuring FILE adapter physical paths from binding file PortBindings.xml...
                  Processing FILE adapter physical paths (Send)...
                     Setting up path C:\Test\X5\ProcessingLayer\ReceivedMessages...
                  Processing FILE adapter physical paths (Receive)...
                     Setting up path C:\Test\X5\OnRamp\ReceivePollRequest...
            Target DeployAppDefinition:
                BTSTask.exe AddApp -ApplicationName:"BSP.Systems.X5.Costings" -Description:"BSP.Systems.X5.Costings"
                Microsoft (R) BizTalk Application Deployment Utility Version 3.9.469.0
                Copyright (c) 2010 Microsoft Corporation. All rights reserved.
                Information: Adding new BizTalk application "BSP.Systems.X5.Costings" to configuration database (server="WIN-HFQP3MTMDMC", database="BizTalkMgmtDb")...
                Information: Added application "BSP.Systems.X5.Costings".
                Command succeeded with 0 errors, 0 warnings.
            Target DeploySharedAssemblies:
                Deploying additional assemblies to GAC...
                "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\Framework\DeployTools\gacutil.exe" /i "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\Framework\DeployTools\SSOSettingsFileReader.dll"
                Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
                Copyright (c) Microsoft Corporation.  All rights reserved.
                Assembly successfully added to the cache
                Finished deploying additional assemblies to GAC.
            Target ImportBindings:
                Copying file from "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\PortBindings.xml" to "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings_PortBindings.xml".
                BTSTask.exe AddResource -Type:BizTalkBinding -Overwrite -Source:"C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings_PortBindings.xml" -ApplicationName:"BSP.Systems.X5.Costings"
                Microsoft (R) BizTalk Application Deployment Utility Version 3.9.469.0
                Copyright (c) 2010 Microsoft Corporation. All rights reserved.
                Information: Adding resource (-Type="System.BizTalk:BizTalkBinding" -Luid="BSP.Systems.X5.Costings_PortBindings.xml") to application "BSP.Systems.X5.Costings"...
                Information: Validating resources (count=1)...
                * Validating resource (-Type="System.BizTalk:BizTalkBinding" -Luid="BSP.Systems.X5.Costings_PortBindings.xml")...
                Information: Performing change requests...
                Information: Calling BeginTypeChangeRequest for all selected resource types...
                Updating resource (-Type="System.BizTalk:BizTalkBinding" -Luid="BSP.Systems.X5.Costings_PortBindings.xml") in store.
                Information: * Performing change request on type "System.BizTalk:BizTalkBinding" (count=1)...
                Information: Commit the change requests...
                * Performing EndTypeChangeRequest for resource type "System.BizTalk:BizTalkBinding".
                Command succeeded with 0 errors, 0 warnings.
                Deleting file "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\BSP.Systems.X5.Costings_PortBindings.xml".
                BTSTask.exe ImportBindings -Source:"C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\PortBindings.xml" -ApplicationName:"BSP.Systems.X5.Costings"
                Microsoft (R) BizTalk Application Deployment Utility Version 3.9.469.0
                Copyright (c) 2010 Microsoft Corporation. All rights reserved.
                Information: Importing bindings "C:\Program Files (x86)\BSP.Systems.X5.Costings\1.0\Deployment\PortBindings.xml" into application "BSP.Systems.X5.Costings" in BizTalk configuration database (server="WIN-HFQP3MTMDMC", database="BizTalkMgmtDb")...
                Information: Imported application "BSP.Systems.X5.Costings" bindings.
                Command succeeded with 0 errors, 0 warnings.
            Target DeployBtsNtSvcExeConfig:
                Updating C:\Program Files (x86)\Microsoft BizTalk Server 2010\BTSNTSvc.exe.config...
                Adding/updating debugging configuration data...
                Saved updated BizTalk configuration file.
                Updating C:\Program Files (x86)\Microsoft BizTalk Server 2010\BTSNTSvc64.exe.config...
                Adding/updating debugging configuration data...
                Saved updated BizTalk configuration file.

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:16.96

<Project xmlns="" DefaultTargets="Deploy">
  <Import Project="C:\Program Files (x86)\TransMock\BTS2013\Ext\TransMock.targets"/>
Mar 1 at 10:05 PM
Hi Geoff, thanks for sharing your BTDF log. If you do not find any reference of invocation of TransMock in the log, and particularly the mockifier, then this is the first clue that it is not invoked at all. It seems that the import tag is placed and configured correctly, but have you veryfied that the .targets file exist on the given path? As Jim suggested there is a bug for where the framework is deployed, so the path might not be correct.
But hang on a minute - I just noticed that you have deployed the framework for BizTalk 2013, but are using it with BizTalk 2010! Correct? In such case I would suggest that you uninstall this version, download and isntall the framework version for BizTalk 2010. Then this should work fine. Please note that this installer puts the framework by default under C:\Program Files (x86)\TransMock\BTS2010, so you would be required to repoint to the correct .targets file path in the Import tag. I guess the confusion came from the fact that the article is using BTS 2013 as an example and it is not that explicit that for other versions of BizTalk one should use the corresponding version of the framework.
And apologies - I should have noticed this already from your first post.
And yes, I agree that It is a bit tedious to have different installers for the different versions of BizTalk, but specifically for version 2010 i would not bother doing anything with the installer as it is already in extended support and hopefully there will not be many who still use this version in the near future.

Hope that helps.
Cheers, Svet