Deploying a dll to the GAC and recycling the application pool

When developing a sharepoint dll in Visual Studio 2005 the quickest way to deploy and test your dll is to automate it with a post build event.

How do we do this?

1.- Open the properties window for your project... solution explorer> right click project name > select properties.

2.- Click "Build Events".

3.- Paste

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" -i "$(TargetPath)" } C:\Recycle.vbs

in to the "Post-build event command line" field.

4.- Create a new text file with the following script:

strAppPoolName = "Sharepoint - 80"
strComputer = "."
Set objWMIService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\"& strComputer & "\root\microsoftiisv2")
Set colItems = objWMIService.ExecQuery("Select * From IIsApplicationPool Where Name = 'W3SVC/AppPools/" & strAppPoolName & "'")
For Each objItem in colItems
Wscript.echo "Recycle Completed"

5.- Save as C:\Recycle.vbs

1 comment :

  1. Thanks. I used to develop dll in Vb, not try .net yet.
    I'll give it a try.
    thanks again.