Archive for February, 2008

Refactoring the Namespace of Files in a BizTalk Project

February 25, 2008 Leave a comment

Most of us have probably started a BizTalk project with limited knowledge of what the end solution will look like. This often means that we start out with silly names for things, including our project and solution. Then, after BizTalk has autogenerated namespaces (the C# namespace for the file – not the xsd namespace) for many items (such as xsd’s), we decide to improve our naming, only to find out that we’re kind of stuck, unless we want to start all over again. Just to be really clear, I’m referring to the namespace shown in the properties window of a file before it’s opened. I know this can be confusing since there is another namespace, e.g. the target namespace, which is shown once an xsd is opened.

Well, something similar happened to me the other day at work – I was handed some code developed by another person who is now on vacation. I realized that the project was created in a very agile fashion, which is usually a great thing, but the downside of this iterative development was that I now had namespaces for the XSDs such as “TestSiebelAdapter” and “http://SiebelPOC”. Well after a colleague, Richard Seroter, and I did some looking in the Visual Studio project files, Richard found the the .btproj file is an xml file that contains a lot of this information. So, if you’re careful, you can search and replace within this file to fix some of your horrid naming. This will cause orchestrations to break – but you can search and replace within those as well. Of course any time you’re going to do something like this I highly recommend making a backup of your solution first.

Here’s a sample of the xml you’d be changing in the .btproj file:

RelPath = “XYZ_To_ABC.btm”
BuildAction = “Compile”
Namespace = “TestSiebel
Type = “Transform_1”
Categories: BizTalk Server