Geeks With Blogs

Steve Clements .Net and then some....

Now that is a bad ass title!!

Anyone who has been through the MindSharp training course for SharePoint and any others that have looked at any code Todd Bleeker puts out there will most certainly be aware of using post build scripts in Visual Studio to deploy your sharepoint project.  This knowledge is of course not limited to MindSharp grads, its just that being one I know what they know!

To get them to work in a Windows 2008 and Visual Studio 2008 environment you will need to make some changes.  As pointed out here, GacUtil has moved so the command will change from


"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" /if "$(TargetPath)" /nologo

to this

"%programfiles%\Microsoft SDKs\Windows\v6.0A\bin\GacUtil.exe" /if "$(TargetPath)" /nologo

...and the command to recycle the app pool in IIS7 has changed, if you try the old way you will most likely get a Microsoft.CmdLib error when building from VS.  The required command has changed from


"%systemroot%\system32\iisapp.vbs" /a "[YourAppPool]" /r

to this

"%systemroot%\system32\inetsrv\APPCMD" recycle apppools "[App Pool Name]"

This is as much for me as everyone else as I no doubt will come up against this again!

For completeness here is my postbuild script for a custom field project, you might not want to copy the debug pdb file or create a solution (last two commands)

cd "$(ProjectDir)"

"%programfiles%\Microsoft SDKs\Windows\v6.0A\bin\GacUtil.exe" /if "$(TargetPath)" /nologo

"%systemroot%\system32\inetsrv\APPCMD" recycle apppools "App Pool Name"

xcopy "TEMPLATE" "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\" /ys

xcopy "$(TargetDir)*.pdb" "%systemroot%\Assembly\GAC_MSIL\OC.Sharepoint.FieldTypes\[token]\" /ys

MakeCab.exe /f FileName.ddf

Posted on Monday, June 9, 2008 6:49 PM Sharepoint , Visual Studio | Back to top

Comments on this post: Postbuild script for Sharepoint project in Windows 2008 and Visual Studio 2008

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Steve Clements | Powered by: