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"
-
Archives
- October 2011 (1)
- 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)
-
Categories
-
RSS
Entries RSS
Comments RSS


