The BizTalk Server 2004 File Dump utility can be downloaded from the User Samples section of www.gotdotnet.com. Please provide any feedback (bugs, suggestions etc.,) via this page.
ReadMe
What does the File Dumper utility do?
The BizTalk Server 2004 File Dumper utility allows you to dump the generated output of the Visual Studio BizTalk project to a selected folder. BizTalk Server 2004 does not provide a true compiler. Instead, it generates C# code for schemas, maps, pipelines, orchestrations, in-line functoids, XMLSerializers etc., and then shells out to the C# compiler in order to create assemblies. These C# files are highly transient, and are deleted as soon as compilation is complete. The File Dumper utility allows you to capture copies of the C# code, together with the command line and output used during C# compilation. The utility also produces a batch file based on the generated command line, and adapted to point to the copies of the C# source code.
Why would I use this utility?
Good question! You can rely on BizTalk Server 2004 and Visual Studio to generate assemblies for you without ever having to see the generated C# source code. This is what Microsoft intended. Although it is certainly possible to amend and rebuild the C# code outside of a BizTalk project, your code will be harder to maintain, and there is a danger you may introduce code which conflicts with the functioning of the BizTalk engine. It is not recommended that you use the source code directly in this way unless there is a compelling reason to do so.
Most users of this utility will dump the C# code simply to learn more about how BizTalk Server 2004 works behind the scenes. Studying the C# source code can prove highly instructive, allowing you to see precisely how, for example, XLANG/s script is used to generate Orchestration code and expressions, or how an Orchestration interacts with the engine. This utility is designed to support the BizTalk learning curve and complex troubleshooting, debugging and problem-hunting scenarios.
How do I use the utility?
First install the utility by running the BTSFileDumpInstall.msi package. Then use as follows:
- Launch the utility by selecting 'BizTalk File Dump Utility' from 'Start/All Programs' or by double-clicking the desktop shortcut.
- Click the 'Select...' button and select your chosen output directory. Alternatively, type in the name of the output directory. If the directory does not exist, it will be created.
- Click the 'Start dumping files' button once to start 'listening'. The panel to the right of the button should turn red.
- Open a BizTalk Server 2004 project in Visual Studio and select 'Build/Rebuild solution' from the menus.
- Once the rebuild is complete, click the 'View output folder' button to view the dumped files using Windows Explorer.
In addition....
- You can stop and restart listening to the temp folder at any time using the 'Start dumping files' button.
- To delete all files in the output folder, click the 'Delete all files in output path' button.
- If you don't want the utility to generate additional batch files, unselect the 'Auto-generate Make files' option.
- Click the 'Clear list' button to clear the contents of the log output list.
How does the File Dumper utility work?
Very simply! The code uses the FileSystemWatcher .NET class to respond to any changes made to certain files in the Local Settings\Temp folder in the current user's profile.
When BizTalk Server 2004 generates C# code, it places this code into a Temp directory (as specified by the TMP or TEMP environment variables), compiles it, and then deletes the code. Because there is a short delay while the code is compiled, the File Dumper utility has an opportunity to copy these files to another location.
This mechanism is not foolproof. It is possible for files to be deleted by the BizTalk compiler before they are copied successfully by the File Dumper utility. You will be warned then this has happened. If you simply rebuild the BizTalk project again, it is likely that the timing problem will not reoccur. However, there can be no absolute guarantee that all files will be dumped by the utility.
You must 'Rebuild' rather than 'Build' your BizTalk project in order to dump the entire project.
What types of file are created?
- C# source files (.cs)
- Command Line files (.cmdline)
- Command output files (.out)
- Error output files (.err)
- Make files (.bat)
The .out and .err files are created during compilation of the original source code file. There may not be any .err file generated.
'Make' files are created by the utility by copying the contents of .cmdline lines and replacing paths to the original source code with paths to the output folder. In addition, the command line is appended to a call to the csc.exe (C#) compiler. The Make files do not change the assembly output location. This location is the 'obj' folder under the BizTalk project folder.
Why are there several Make files?
When BizTalk Server 2004 creates a new assembly, it generates a number of temporary assemblies during the process. These include assemblies containing in-line functoid code, maps and XMLSerialisation code, as well as assemblies containing schema definitions. Schema assemblies are created in the 'obj' folder. Other assemblies are created in the Temp folder. The utility does not attempt to analyze the dumped files to determine which are for temporary assemblies. Instead, it dumps everything. The last Make file generated is for the final assembly produced by BizTalk projects.
There are additional aspects of code generation in BizTalk Server 2004. For example, HAT generates and compiles temporary code in order to instantiate classes which populate property grids. This code is dumped to the output folder.
Who's responsible for this?
The utility was written by Charles Young. Charles works for SolidSoft Ltd., a UK-based BizTalk Integration specialist company and Microsoft Gold Partner.
Copyright © 2004 Charles Young. All rights reserved.
THIS SOFTWARE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
You may not distribute this software in any form without express written permission of Charles Young. To report any problems, provide feedback, raise queries or download the latest version, please visit Charles' weblog site.