I saw a search engine hit on my blog for this today, and thought I'd share my Post-Build Command Line. I'd found the bones of this from other bloggers, but added a few things of my own:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" -u $(TargetName)
copy "$(TargetDir)$(TargetName).DLL" "C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents\"
copy "$(TargetDir)$(TargetName).DLL" "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents\"
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" -i "$(TargetDir)$(TargetName).DLL"
First thing to know is that you MUST start Visual Studio as an Administrator (in Vista anyways) in order for the GAC commands to work.
Breaking down that set of commands:
The first command uses GACUtil to remove the component from the GAC - this is NOT strictly necessary, as installing a new component replaces the old one. However, I like to do it step by step in case there are problems, and this way I can tell where the problem occurred. My GACUtil was installed with the .Net SDK - yours may be located somewhere else, just use Windows Search to find it.
The next two lines copy the project's target DLL to the (standard) x86 and x64 PipelineComponents folders (I run 64-bit Vista). If you're just using a 32-bit OS, remove the "(x86)" line.
The last line adds your component to the GAC, plain and simple.
I find gacutil -if is simpler and more reliable than a -u to uninstall followed by -i to install. This is a force install (overwrite), so doesn't complain if there is nothing to uninstall.
ReplyDeleteI hear you - but that got me thinking...
ReplyDeleteI will now probably move the GACUtil -u to my Pre-Build event. That way, if the component fails to compile, and I don't "notice", I won't be using an old version of the DLL...
(And no, I usually don't have the component VS session start a BIDS session when I debug. I start BIDS with another package and attach if I need to...)