Post Build steps for both 64bit and 32bit development
Posted by robkraft on July 4, 2010
We recently upgraded a developer workstation to 64bit windows and learned that our project post-build steps did not work because the folder names are different. To remedy this problem we replaced the post build with a call to a batch file that gave us more control over the post build logic.
The post build in most of all our projects now only contains something like this:
Call “c:\dev\Postbuild.bat” $(TargetPath) $(ProjectName) ourProjectName
The “Call” command is always recommended for invoking batch files. We hard-coded the folder that contains the .bat file. The 3 pieces of data following that are input parameters to the DOS batch file.
To install to the GAC on the 64bit or 32bit machines, our batch file has this code:
IF EXIST “c:\Program Files (x86)\”. (set gacexe=”C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil”) ELSE (set gacexe=”C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil”)
%gacexe% /u %3
%gacexe% /if %1
To copy files to the correct nunit folder we have code in the batch file like this:
IF EXIST “c:\Program Files (x86)\”. (set nunitdir=”c:\program files (x86)\nunit\bin\net-2.0″) ELSE (set nunitdir=”c:\program files\nunit\bin\net-2.0″)
xcopy %1 %nunitdir% /Y
I hope someone else gets some value from this.