When working with SharePoint, you'll find yourself working with the GAC quite often during development.
If you've seen the light and you're working with SharePoint on a VM, one tricky problem is how to update the GAC using a post-build event. The following is a little script that I use:
::----------------------- GAC binaries code ------------------------ :: Check if the share is available on the server IF EXIST "\\server-name\temp" GOTO COPYFILES GOTO SHOWNOTICE :: Copy file to the server :COPYFILES ECHO Found \\server-name\temp; proceeding to copy files... SET SN=\\server-name\temp :: Copy the binary XCOPY "$(TargetPath)" "%SN%" /Y /I :: Use PsExec to execute gacutil PATH=$(SolutionDir)Tools;%windir%\Microsoft.Net\Framework\v2.0.50727;%programfiles%\Microsoft SDKs\Windows\v6.0\Bin;%path% psexec \\server-name -u Administrator -p password -w "c:\temp" gacutil.exe /i "$(TargetFileName)" /f GOTO END :SHOWNOTICE ECHO Your VM image is not sharing the directory "c:\temp" GOTO END :END ECHO Completed
The batch script makes use of Sysinternal's PsExec. I've included the binary executable in my solution tree under the directory "Tools".
The script only has one assumption: the VM (or remote machine, really) is sharing the c:\temp directory (okay, and that the path to gacutil.exe has been added to the remote machine's PATH environment variable). Here's a breakdown of the logic:
Enjoy!
Remember Me
newtelligence dasBlog 1.8.5223.0
This site is a combo blog/portfolio for me, Charles Chen.
Sign In