Saturday, December 4, 2010

Tip: Replicating BizTalk Server 2010 dashboard settings across Host(Instance)s

One of the core enhancements introduced with BizTalk 2010 edition is improved BizTalk Settings Dashboard. This feature provides us an unified location to set various performance tuning settings at Group or Host or Host Instance level. In order to open this settings window, right click on BizTalk Group and choose Settings. We can also find Import and Export options on this window which allows us to migrate settings between various environments (like QA, UAT, PROD etc.) using Import and Export buttons. Here is an interesting use case of this Import/Export feature.

It is very common that we create multiple Hosts(InProcess and/or Isolated) and/or multiple Host instances under each Host as needed. It would also be common that we might want to set similar settings (with minor changes) on these hosts and/host instances. Since there are lot of settings available to fine tune the performance, it would be lot of manual effort to manually configure these settings across multiple host/host instances. So we can simplify this by configuring settings on one Host and/or one Host Instance and export to an xml file. And then Import this file on same server and map the Host/HostInstance(on Source side) that we configured to all other Hosts/Host Instances(on Destination side). After finishing the wizard, we can see that settings get replicated as intended and we can then go ahead make if there is any slight modifications needed for specific Host/Host instance. Here is sample screen shot of mapping part of the wizard,


Tuesday, November 23, 2010

Tip: Verification of imported BizTalk assemblies after deployment

As we all know, we need to import and install BizTalk assemblies in order to use at run time and these assemblies get GACed during install operation and inserted into BizTalkMgmtDb database during import operation. If we are not updating version for the assemblies and overwrite with new assemblies each time(although this is not preferrable), it is important to make sure that assemblies are imported and installed correctly.

We can easily verify the timestamp on assemblies in GAC to make sure that Install operation is successful. We can verify import operation of Schemas by looking at schema content(not timestamp though) inside BizTalk Admin Console( =>Schemas=> =>Right click and choose Schema View). But unfortunately there is no such direct way to verify contents or timestamp of  other types of BizTalk artifacts like map, orchestration etc. A work around to verify that would be to query against bts_assembly table in BizTalkMgmtDb database*. Here is a sample query to view recently deployed assemblies on top of the result set,

select * from bts_assembly order by dtDateModified desc

*Microsoft does not recommend accessing BizTalk databases directly.


Monday, November 8, 2010

Tip: Specifying Key file path for BizTalk projects

As we know, key file needs to be specified for any BizTalk project in order for assembly to have strong name before GAC/deploy the same. We could specify this key file either through project properties or in AssemblyInfo.cs file. We can conveniently specify the path to key file if we choose the later. But if we specify the path to key file using Project Properties window, I observed that a copy of key file is being created in respective project folder and same is being referenced. But there may be times where we might want to specify key file from a different location to avoid multiple copies of key file. Here are couple of such scenarios,

1. When we like to maintain key file at some common location(like at root level) and share the same across multiple BizTalk projects/solutions

2. When we migrate BizTalk solutions from previous versions, they might contain the path to key file. If we need to change this through browse option, we get local copy of key file and lose the ability to choose different location.

Here is a manual work around to specify key file path at BizTalk project level,

Open BizTalk project in some text editor (like Notepad), and we can observe the following section in that,

For BizTalk Server 2010 project:
< PropertyGroup >
<SignAssembly > true/false</SignAssembly>
<AssemblyOriginatorKeyFile><path to key file here></AssemblyOriginatorKeyFile>

For BizTalk Server 2009 project:

<PropertyGroup >
<AssemblyOriginatorKeyFile><path to key file here></AssemblyOriginatorKeyFile>
<SignAssembly > true/false</SignAssembly>

Specify key file path in the AssemblyOriginatorKeyFile node and save the file. Now we can see the same path in Properties window as well.

Fix : Dll locking issue by Visual Studio

I have observed the following error while building BizTalk schemas and maps projects.

Unable to copy file "obj\Deployment\Schemas.dll" to "bin\Deployment\Schemas.dll". The process cannot access the file 'bin\Deployment\Schemas.dll' because it is being used by another process.

I could get rid of this annoying error after doing following tasks,

1. Paste the following script in PreBuild events section of
Schema Project->Properties window (found about this script on this blog entry),

if exist "$(TargetPath).locked" del "$(TargetPath).locked"

if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

2.Set CopyLocal property of Schemas dll to False

UPDATE [06.14.2015]:
Here is another alternative to get rid of this error:

We get this error most likely when we add references to other projects or dll file from project bin directory directly. Instead build and GAC the referenced project and then add reference from GAC. This way even if we open both projects in different Visual Studio windows, we will not see this locking error.