Remote Deployment, GAC with PSExec

[Cross-post from old blog.]

Recently a customer needed a way to deploy BizTalk applications to a shared development server, but due to corporate IT policies they were unable to run a local instance of BizTalk Server to test from.  Deployment from Visual Studio would create the BizTalk application on the remote server and register the assemblies in the application database; however the assemblies were not present on the server nor were they in the Global Assembly Cache (GAC).

For QA or production, please do a true deployment using an exported MSI. =)

There are a number of elaborate frameworks for handling remote deployments, such as Scott Colestock's remote deployment framework using NAnt, or using Stephen Thomas' MSBuild method.  I wanted to provide a much simpler solution for the customer, and while it lacks a certain "cool factor," it gets the job done pretty well.

The solution: PSExec (part of the Windows Sysinternals PSTools kit), which allows command-line execution on a remote server, provided you have authorization, that is.

The first step was to create a "deployment" location on the development server, and expose it via a network share.  Then on the development PC, we set up a simple batch file.  For each assembly in the solution, we have a three-step process:

  • Un-GAC the assembly on the remote server (optional, I suppose):
    • PSExec \\servername [args] gacutil /u ...
  • Copy the assembly to the remote server:
    • Copy BizTalkAssemblyName.dll \\servername\remotedeploy\projectname.
  • GAC the assembly on the remote server:
    • PSExec \\servername [args] gacutil /i ...

Now during development, when ready to test a portion of code on the development server, they simply right-click the solution in Visual Studio, choose deploy, then once the deploy completes successfully (fingers crossed), double-click the batch file.

I'm sure there are other "cool" ways of accomplishing this, hopefully in a more automatic way (please share if you know of any).  Again, don't do this for QA or production.


Technorati tags: BizTalk