How to create an installer using MSBuild & VMware CloudUtil to deploy new workflows/assemblies.

Whenever I develop workflows, assemblies etc against VCAC one of the first things I do is create an msbuild installer, this allows me to uninstall/install a fresh copy each time when testing or deploying the updates into the repository.

Using MSBuild to callout to VCAC Cloudutil command can allow for a simple but powerful way of delivering your extensibility over this platform.

CloudUtil 

The CloudUtil command main features are:

  • Install/update or uninstall workflows into the repository
  • Install or Uninstall assemblies (dlls that store any custom code logic such as workflow activities that may have been written)
  • Install/update or uninstall powershell scripts (or any file)

Example Workflow

An example solution can be downloaded here, it includes both a Microsoft Dll (where the workflow activities reside) and a worflow to install.

Example MSBuild file


 
    $(MSBuildProjectDirectory)\..\..\..\..\
    $(IntegrationSourcePath)
    C:\Program Files (x86)\DynamicOps\Design Center
    C:\Program Files (x86)\DynamicOps\DCAC Server
    C:\Program Files (x86)\DynamicOps
    .\bin
    $(COMPUTERNAME)
    DCAC
    DCAC
   
   
 

 
   
   
 

 

  <Target Name="CommonFeaturesInstall"
DependsOnTargets=”CopyDCACFiles;”/>

 
   
   

 
   
   

 
 

 
   
   
 

 
     
 

 
   
 

 
 

 
 

 

 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
   
   
 

Installation Output

This file (along with the include file Common.Targets.xml) will do the following:

>Install.bat                                                                     
>C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild UserCreationInstaller.xml /p:IntegrationSourcePath=. /p:CommonDeploySourcePath=. /p:DBServer=localhost     /p:DBName=DCAC /p:DBCatalog=DCAC                                                 
Microsoft (R) Build Engine Version 4.0.30319.1                                   
[Microsoft .NET Framework, Version 4.0.30319.239]                                
Copyright (C) Microsoft Corporation 2007. All rights reserved.                   
Build started 3/14/2013 8:47:01 AM.                                              
Project “C:\Users\Administrator.CORP\Documents\Visual Studio 2010\Projects\Clea  
rAsCloud.Sample\Installer\UserCreationInstaller.xml” on node 1 (default targets  
).                                                                               
StopIIS:                                                                          
  net stop w3svc /y                                                              
  The World Wide Web Publishing Service service is stopping.                      
  The World Wide Web Publishing Service service was stopped successfully.        
StopServices:                                                                    
  net stop VMManager                                                              
  The VMware vCloud Automation Center service is stopping.                       
  The VMware vCloud Automation Center service was stopped successfully.          
DeleteCacheFiles:                                                                
  Deleting file “C:\Windows\Temp\RepositoryCache\DynamicOps.ManagementModel.Com  
  mon.dll”.                                                                      
  Deleting file “C:\Windows\Temp\RepositoryCache\DynamicOps.ManagementModel.dll  
  “.                                                                             
  Deleting file “C:\Windows\Temp\RepositoryCache\DynamicOps.ProfileModel.dll”.   
  Directory “\bin\Debug\dem\AssemblyCache” doesn’t exist. Skipping.              
StartIIS:                                                                        
  net start w3svc                                                                
  The World Wide Web Publishing Service service is starting.                     
  The World Wide Web Publishing Service service was started successfully.        
CopyDCACFiles:                                                                   
  Copying file from “.\bin\External-CreateADUserWorkflow.xml” to “C:\Program Fi  
  les (x86)\DynamicOps\DCAC Server\ExternalWorkflows\xmldb\External-CreateADUse  
  rWorkflow.xml”.                                                                
  Copying file from “.\bin\ClearAsCloud.ActiveDirectory.Activities.dll” to “C:\  
  Program Files (x86)\DynamicOps\Design Center\ClearAsCloud.ActiveDirectory.Act  
  ivities.dll”.                                                                  
  Copying file from “.\bin\CreateADUserWorkflow.xaml” to “C:\Program Files (x86  
  )\DynamicOps\Design Center\CreateADUserWorkflow.xaml”.                         
  Copying file from “.\bin\External-CreateADUserWorkflow.xml” to “C:\Program Fi  
  les (x86)\DynamicOps\Design Center\External-CreateADUserWorkflow.xml”.         
Assembly-Uninstall:                                                              
  “C:\Program Files (x86)\DynamicOps\Design Center\CloudUtil.exe” Assembly-Unin  
  stall -f “ClearAsCloud.ActiveDirectory.Activities.dll” -v                      
  This product is licensed to: VMware vSel                                       
  License expires on: 10/31/2013                                                 
  Command completed successfully.                                                
Workflow-Uninstall:                                                              
  “C:\Program Files (x86)\DynamicOps\Design Center\CloudUtil.exe” Workflow-Unin  
  stall -n CreateADUserWorkflow -v                                               
  This product is licensed to: VMware vSel                                       
  License expires on: 10/31/2013                                                 
  Command completed successfully.                                                
Assembly-Install:                                                                
  “C:\Program Files (x86)\DynamicOps\Design Center\CloudUtil.exe” Assembly-Inst  
  all -f “.\bin\ClearAsCloud.ActiveDirectory.A ctivities.dll” -v                  
  This product is licensed to: VMware vSel                                       
  License expires on: 10/31/2013                                                 
  Command completed successfully.                                                
Workflow-Install:                                                                
  “C:\Program Files (x86)\DynamicOps\Design Center\CloudUtil.exe” Workflow-Inst  
  all -f “.\bin\CreateADUserWorkflow.xaml” -n CreateADUserWorkflow -v            
  This product is licensed to: VMware vSel                                       
  License expires on: 10/31/2013                                                 
  Command completed successfully.                                                
StartServices:                                                                   
  net start VMManager                                                            
  The VMware vCloud Automation Center service is starting.                       
  The VMware vCloud Automation Center service was started successfully           
Build succeeded.                                                                 
    0 Warning(s)                                                                 
    0 Error(s)                                                                   

Overview

The installer here is useful as it shows the various commands used to install/uninstall various components into VCAC Application Server.
  1. IIS is restarted
  2. All repository cache files are cleaned up
  3. Files are copied to various locations
  4. Assemblies are uninstalled in the repository
  5. Workflows are uninstalled in the repository – they could just be updated for rollback, this is assuming a first install.
  6. Assemblies are installed in the repository
  7. The workflow is installed in the repository
  8. The application server is restarted