AutoGAC your class library after build

Posted on 10/14/2007 @ 8:54 PM in #SharePoint by | Feedback | 3485 views

Okay, this is silly because I keep forgetting the exact syntax, but this is incredibly useful whenever writing any code for SharePoint.

So I'm putting this on my blog for future copy paste pleasure -

Just add the following to PostBuild Events -

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i $(TargetPath)

By doing so, everytime you build your class library, it will automatically be added to the GAC for you.

One less thing to worry about - bak2wurk!

Sound off but keep it civil:

Older comments..

On 10/14/2007 10:22:08 PM Eber Irigoyen said ..

On 10/15/2007 8:28:58 AM Kent Boogaart said ..
Only problem is gacutil requires local admin, so may need to use runas if you develop as a normal user.

On 10/15/2007 10:45:00 AM Sahil Malik said ..
Hey Kent -

Did you fall for those marketing folks who don't really develop for a living themselves, but keep asking you to develop as a limited user on Vista? ;-)


On 10/15/2007 11:52:29 AM Kent Boogaart said ..
No, I fell to some malware at one point and made the decision myself. If I listened to the marketers then - you're right - I *would* be using Vista, not XP :) Actually, I do use Vista on one machine, but it's a work laptop.

PS. Never had any issues except the occasional one like with gacutil when developing as normal user. Just have to switch to admin to install stuff.

On 10/17/2007 8:32:55 PM Clinton Cherry said ..
I also like to add to my prebuild the GAC uninstall event, which is the same as you mentioned, except with /u parameter instead. This ensures that the older version of your assembly is definitely removed before you install the newer version

On 10/17/2007 9:00:22 PM Sahil Malik said ..
Good point CC