Deploying SharePoint WebParts in development environment.

Developing SharePoint WebParts with generic controls is a straight forward task. For such WebParts we can always use a development Web site in our Visual Studio environment to work on the details and then deploy the control to WSS. With complex WepParts using specific WSS features this is not the case. The control has to be deployed to the WSS server after each and every change. Once you register the control in web.cofig and in your Web site (for more information click here), I found it very convenient to deploy the WebPart directly to the _app_bin folder of the Web site. This would work fine only if IIS did not lock your DLL. To work around this I created a Pre-build and Post-build tasks in the VisualStudio project file. Place the script files in your project folder and specify the server name. StopAppPool.vbs
strComputer = "[server name]" Set objIIS = GetObject _ ("IIS://" & strComputer & "/W3SVC/AppPools/SharePoint (80)") objIIS.Stop
strComputer = "[server name]" Set objIIS = GetObject _ ("IIS://" & strComputer & "/W3SVC/AppPools/SharePoint (80)") objIIS.Start

Both tasks execute VBScript that stops and then starts the application pool of the Web site once the newly built DLL is copied over and your developer life gets a bit simpler. Dovizhdane!


Anonymous said…
nice trick. The iis locking the DLL is crazy.