Once in a while you have to deploy assemblies for a SharePoint based solution (ok, you also might have other solutions which need Assemblies , but in my case I just stumbled across a SharePoint based solution). But deploying the assembly to the GAC or the local bin folder does not mean, that SharePoint (or the IIS) automatically pick up this new version of the Assembly.
Usually you’ll issue an iisreset command in order to get IIS to reload all needed assemblies. Unfortunatly this does take some time, until IIS is fully restarted. This is especially true, when more than one application-pool is running within IIS (for e.g. central administration as well as a couple of web-applications).
Actually it would be sufficient just to restart the portal web-application instead of the whole IIS. So this would mean, we only restart the application pool. Actually this is quite easy to do. Using iisapp.vbs this is just a matter of
cscript iisapp.vbs /a "SharePoint - 80" /r
Actually this could also be part of a nant-build script, so that with each build the application pool is being restart.
<?xml version="1.0" encoding="utf-8" ?> <project name="Solution" default="deploy" xmlns="http://nant.sf.net/schemas/nant.xsd"> <loadtasks assembly="f:\build-tools\nantcontrib\bin\nant.contrib.tasks.dll"/> <target name="build"> <msbuild project="FirstActivity.csproj"/> </target> <target name="deploy" depends="build"> <gac-install > <assemblies> <include name="bin\Debug\FirstActivity.dll"/> </assemblies> </gac-install> <exec program="cscript" commandline="iisapp.vbs" workingdir="c:\windows\system32" verbose="true"> <arg value="/a "SharePoint - 80"" /> <arg value="/r"/> </exec> </target> </project>