Search code examples
visual-studio-2005biztalkbiztalk-deployment

Automatically deploy referenced assembly as "Resource" in VS2005/Biztalk 2006


I have a two-project solution - one project contains my schemas and BizTalk orchestration, and the other contains a DLL that is referenced from my orchestration and does that actual work (it's shared code, so there's no chance I can just incorporate it into the BizTalk assembly). The second assembly is added as a reference from the BizTalk one, and I can reference the methods in #2 from the orchestration without any trouble.

However, when I deploy from VS -> BizTalk, it doesn't take my resource assembly with it - it just deploys the BizTalk assembly. If I attempt to trigger my orchestration, I'll get an error that the referenced assembly couldn't be loaded, but once I add it to the GAC and the "Resources" list for my BizTalk app, things run perfectly.

How can I flag this assembly as something that has to be deployed with my BizTalk assembly? Am I just missing a setting on the reference somewhere?


Solution

  • Place the following statements in a batch file and run it from VS Command Prompt

    BTSTask AddResource -Source:.\Assemblies\Schemas.DLL 
      -ApplicationName:MyApp -Type:System.BizTalk:BizTalkAssembly 
      -Options:GacOnImport,GacOnInstall -Overwrite
    BTSTask AddResource -Source:.\Assemblies\Orchestrations.DLL 
      -ApplicationName:MyApp -Type:System.BizTalk:BizTalkAssembly 
      -Options:GacOnImport,GacOnInstall -Overwrite
    BTSTask AddResource -Source:.\Assemblies\SharedLib.DLL 
      -ApplicationName:MyApp -Type:System.BizTalk:Assembly 
      -Options:GacOnImport,GacOnInstall -Overwrite
    BTSTask ExportApp -ApplicationName:MyApp -Package:MyApp.msi
    

    You get an MSI at the end, which you would need to import! This addresses your problem.