Post build task to add .Net component to GAC
Occasionally I’ll need to write a helper .Net function to fill the gap where standard BizTalk functionality is not flexible enough. This is usually often enough that I follow a pattern of having a “.Helpers” assembly associated with every BizTalk application I develop.
These Helper assemblies compile and can be referenced by other projects in the solution just fine, but when the application is later deployed, or exported as an MSI package, we usually find one of the following occurs:
- A referenced DLL is missing from the GAC (easily fixed),
- An older, stale, version of the Helper dll is exported in the packaged MSI, due to subsequent versions of the Helper not having been updated in the BizTalk metabase
"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe" /i $(TargetPath)
btstask.exe AddResource -Application:{BizTalk Application Name} -Type:System.BizTalk:Assembly -Overwrite -Source:$(TargetPath)
Be sure to remember to replace the {BizTalk Application Name} token with the relevant Application Name, and change the “Run the post-build event” drop-down option to “When the build updates the project output”
Edit: For 32-bit BizTalk environments, replace %ProgramFiles(x86)% with %ProgramFiles%
Edit 2: When working with BizTalk 2010 (and later), the gacutil executable will be found in a different location. This is due to the Framework 4.0 GAC being both structured and located differently to earlier versions. The compatible version of gacutil.exe can now be found at:
"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe"
Calling helper methods from the Business Rules Engine
Here’s a trick that usually gets people new to BizTalk.
The Business Rule Engine has the ability to call (public) static methods on any .Net class, without needing to assert an instance of the class first. However, when you execute your policy, nothing is returned into the policy, and your rules will not work as expected.
The problem is that, by default, the BRE will not execute the static method, unless a specific registry setting is set. This keeps the default behaviour backwards compatible with the original BTS2004 release of the BRE.
To enable calling these methods, add a REG_DWORD key named “StaticSupport“, with a value of “1” to the following registry path:
32-bit Windows
HKEY_LOCAL_MACHINE\Software\Microsoft\BusinessRules\3.0\
64-bit Windows
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\BusinessRules\3.0\
-
Archives
- September 2011 (2)
- August 2011 (2)
- June 2011 (1)
- June 2010 (1)
- November 2009 (1)
- September 2009 (1)
- August 2009 (2)
- July 2009 (2)
- June 2009 (1)
- April 2009 (2)
- March 2009 (2)
- February 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS


