Automatic webpart deployment on SharePoint

To ease the development process of SharePoint web parts there is a simple way to automatically deploy those.

The following batch file assumes that you are deploying to the GAC directly.

Create this batch file called deploy.bat:

@echo off
rem Pass these parameters: $(ProjectDir) $(TargetName)

rem Copy the assemblies to GAC
gacutil.exe -I %1\bin\Debug\%2.dll

rem Restart the application pool
cscript.exe c:\windows\system32\iisapp.vbs /a "[App Pool Name]" /r

Add the following entry to your post-build event command line in the project’s property window:

[path to batch file]\deploy.bat $(ProjectDir) $(TargetName)

Leave a Reply

Your email address will not be published. Required fields are marked *