4

In Tridion 2013 I found updating an event system DLL is a tedious task. Each time it fails.

Is there any Utility available to do this job easily?

Edit

I am stopping COM+, TcmPublisher, TcmSearchIndexer, TcmServiceHost, before copying the DLL.

Sometimes the DLL is copied successfully. But most of time it failed due to holding a lock on the DLL.

  • 3
    Can you please add the version of Tridion? Event system changed a lot between 2009 and 2011 (COM vs .NET) – Nuno Linhares Nov 3 '13 at 11:54
  • 2
    And adding the type of errors you see would help too. – Nuno Linhares Nov 3 '13 at 11:57
  • Your question is rather vague. Please describe the process of updating the DLL, what are the errors you get, when you get them, how is it tedious? Help us help you. – Mihai Cădariu Nov 3 '13 at 17:08
  • i m using SDL tridion 2013.i m stoping Com plus,TcmPublisher,TcmSearchIndexer,TcmServiceHost before copying dll some time dll copied successfully but most of time it failed due to holding a lock on the dll. – Abdul Qadir Nov 4 '13 at 11:26
  • Try this script: code.google.com/p/tridion-practice/wiki/…. It was written for Tridion 2011, so you might need to update it for Tridion 2013. – Frank van Puffelen Nov 4 '13 at 12:17
9

Since way back I have been working with a batch file (which calls a script for COM+ shutdown) called from a post build event in Visual Studio to deploy to my development environment (note this only really works if run on the server itself - but I typically develop event system code on the server, in order to debug it). As it works fine, I never made an effort to update it with Powershell - which would be a better option in this day and age (Dominic's example will give you pretty much the same code).

Heres the batch file, which should be called with the path of the folder where the event dll and pdb is as a parameter. Eg in a post build event:

"$(SolutionDir)\postBuild.bat" "$(TargetPath)"

Note that this version works for 2013 - you may have to tweak the services which are stopped/started for 2011 as the dependencies changed.

@echo off

@echo Stopping Tridion Services
REM stopping the services with 'net stop' instead of 'sc stop' (this is synchronous)
REM note that the other services are dependent on these two so will also be stopped
net stop TCDTransportService /Y
net stop TcmServiceHost /Y

@echo Stopping Tridion Website App Pool 
appcmd stop apppool /apppool.name:"SDL Tridion"

@echo Stopping Tridion Com+ application
cscript "..\..\..\StopComPlus.vbs"

@echo Copying DLL and PDB to Tridion bin\Extensions folder
copy /Y %1 "D:\Tridion\bin\Extensions\"

@echo Starting Tridion Website App Pool 
appcmd start apppool /apppool.name:"SDL Tridion"

@echo Starting Tridion Services
REM starting the services again with 'sc start' instead of 'net start' (this is asynchronous so faster)
REM note that the other services are dependencies of these three so will also be started
sc start TcmBatchProcessor /Y
sc start TCMPublisher /Y
sc start TcmSearchIndexer /Y

@echo Done

StopComPlus.vbs looks like this:

Dim oCatalog 
Set oCatalog = CreateObject("ComAdmin.COMAdminCatalog")
Wscript.Echo "Shutting down SDL Tridion Content Manager"
Call oCatalog.ShutdownApplication("SDL Tridion Content Manager")
Wscript.Echo "Completed shutdown process.  Exiting"
Set oCatalog = Nothing

The only real difference to Dom's script is that the Tridion CM app pool is stopped and started either side of the copy, which I found necessary for 2013, and is a little bit less disruptive than a full iisreset (often on dev environments, the web app(s) are also running in IIS on the same box).

7

The commonest cause of failing to deploy a new events dll is that an existing process is holding a lock on the dll in the file system.

In development, you probably don't care about restarting Tridion, but as you say, it can be tedious. I usually use a script for it. You can see an example on this blog entry. Check out the RestartAllTridion function in there. The example is for 2011, but the same script works fine for other versions with a few minor modifications.

For deploying your events dll to production, the cleanest way is probably to build an MSI installer. (This used to be easy with a Setup project in Visual Studio, but unfortunately someone at Microsoft was allowed to continue working after their unsuccessful brain surgery, and they removed the option to create a Setup project.) You can still do it, but it's more work.

3

Tridion has the old COM+ event system using the Tridion TOM API and the new .NET event system using the Tridion TOM .NET API.

In both cases you can update (deploy) the Event system in different ways. The most common ones are

  • Manual; Update the Tridion Content Manger config which is a one time only task, copy DLL, and restart services manually.
  • Scripted; PowerShell or BAT script deploys DLL and restarts services, CM configuration is often still changed manually (see Dominic and Will's answers)
  • Installer; explains itself.
  • Visual Studio build tasks; Stop services pre build, copy DLL and start rervices post build, manual configuration of CM.

All the automated varieties help to take away the tedious repetitive manual steps. Updating the DLL should not be tedious apart from the manual repetitive tasks and an occasional error while copying a DLL which is in use.

The how to on all of those options above are perfect questions for tridion.stackexchange.

3

The way I do it eliminates any locks on the file and reduces the Tridion downtime to only being while the service is restarted

1) Name the new version of the DLL as CoolEventSystemCode.20151008.DLL (with 20151008 as the current date and optionally .a .b .c for same day revisions)

2) Copy the new DLL to the same folder that the current DLL is in

3) Update the Tridion.ContentManager.config file to refer to the new DLL

4) Restart Tridion.

The previous DLL is there in case you need to revert to it, and downtime is minimized.

2

You can check using ResourceMonitor. https://stackoverflow.com/questions/3565218/how-to-know-what-process-is-using-a-given-file

For me most of the times its used by TemplateDebugHost I had to close templatebuilder too to update dll

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.