Thursday, February 7, 2008

Add Visual Studio Post-Build Events.

Update: a much better alternative.
http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23


One of the most under used features of Visual Studio is the post and pre build events.......

Example: Deploy the assembly to gac and copy the .pdb files in to the assemblies gac directory.
before this gac the assembly and navigate to its (gac) folder from "C:\WINDOWS\Assembly\GAC_MSIL\Assembly NameSpace

1) create a bat file with the following and save it in the bin\debug\postbuild.bat

"C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" /i Assembly Name.dll/f

xcopy Assembly Name.pdb C:\WINDOWS\Assembly\GAC_MSIL\Assembly name space\1.0.0.0__Assembly Public Key Token\

2) Right click the project select properties.

3) Navigate to Build Events

4) In the post build event text box enter the following

call "project path\bin\debug\postbuild.bat"

5) Rebuild the solution ...

Hope this helps