Thursday, February 28, 2008

Postbuild technique to perform various operations including adding assembly in Global Assembly Cache

Using the command line options for "Post-Build" events you can execute any type of DOS commands which could perform different operations.

Create/Open a project in Microsoft Visual Studio.

Add a new file "PostBuild.bat".

Add following commands in it

In Project Properties, go to Build Events.

In "Post-build Event Command Line" add following command to execute your file which is:


Postbuild.bat contents can be:

rem -- set environment specific variables

set projPath=C:\MyProject

set pdbFilePath=d:\MyProject\bin\debug\Edwards.Moss.Web.Common.pdb

set appPoolName="DefaultAppPool"


rem -- copy assembly and debug database

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i %projPath%\bin\Debug\MyProject.dll /f

copy %projPath%\bin\Debug\MyProject.pdb "C:\WINDOWS\assembly\GAC_MSIL\MyProject\\MyProject.pdb"

iisapp.vbs /a %appPoolName% /r

No comments:

Post a Comment

Feel free to give constructive feedback or let me know if it was helpful.