Build and Deploy with msbuild


Badge +8

I've stumped K2 support with this one, but I'm hoping someone in the community has more experience with this.

 

I'm trying to automate deployments of workflows and SmartObjects using msbuild (see here).  I can create a deployment package from within Visual Studio, but I need to be able to automate that process as well (similar to here).

 

I am able to build my process using msbuild, but when I try to create the deployment package using the K2 API, the APi throws an exception:

 

The'CodeExtender' extender project output assembly is missing. Ensure that the project has been built.

 

I get this message unless the process is built from within Vistual Studio.  If I build within Visual Studio, the deployment package is created just fine with the exact same code.

 

So my question is: has anyone successfully created a deployment package without first building in Visual Studio?  Any pointers on the secret sauce VS is adding to the build process that makes the deployment package process work?


2 replies

Badge +8

I've finally been able to create a deployment package via code and MSBuild.  This allows me to perform fully automated deployments with a TFS build server and zero user intervention.  Sharing with the community in case others want to accomplish the same thing.

 

There are two critical bits left out of most tutorials on this matter surrounding the project.Compile() method:

 

  1. The project.Compile() method won't work unless you have all the relevant sourcode available.  This means that if your workflows reference another library, the source for that library must also be available in the location were you are creating the deployment package (e.g. your build server).
  2. The project.Compile() method won't work unless the working directory for your project is the directory where your K2 project is.

These requirements are more than a little frustrating because a) there is no deocumentation for this method, and b) from what I can tell, the project.Compile() method gives you no feedback that there is a problem.  No exceptions, no error message, nothing.  This method will literally sit forever and not tell you there is a problem.  My error above was caused by the fact that I was skipping the calls to project.Compile() because it appeared to be hanging forever since I had not satisifed these two requirements.

 

Once I satisfied these two undocumented requirements, I am able to create a deployment package with an MSBuild task and deploy it to the workflow server via the method documented in KB000188.

 

Also note that this method only works for Workflow projects (not SmartObject projects).  Deploying SmartObject projects is my next objective.

Badge +1

Hi sbrownhuntoilco

Do your automated process still work? I am tying to do the same thing as I want to be able to create a deployment package and deploy the K2 processes in TFS build steps

Reply