My solution to this problem is to provide a setenv.bat file in each project
which configures the environment for the developer/build machine.  The batch
file runs vsvars32.bat and sets the INCLUDE, LIB, and PATH environment
variables.  It also creates a doskey macro 'vs' which invokes devenv.com
with the /useenv switch.    

I also check all the dependencies into source control except for VS.NET.
This includes Platform SDK (we're A C++ shop), DirectX SDK, 3rd party
libraries, in-house libraries and NAnt.  The setenv.bat file sets up the
entire environment relative to the working directory.   The build machine
only needs to have vs.net (we use devenv.com in our build files instead of
<solution>), and the source control client (SVN).  

This approach isolates the development environment for each project.  

Developers check out the project and run the setenv.bat.  To develop, they
run 'vs <path-to-solution-file>'.  For those who will be working primarily
with one project and want the convenience of double clicking a .sln or
.vcproj file from explorer, I provide another script which sets the global
VS.NET development environment (i.e. Tools->Options->Projects->VC++
Directories) from the environment variables.

On the build machine, a bootstrapper script checks out the source, runs
setenv.bat, and then starts the Nant build.

Below is a sample setenv.bat 

Cheers,
Bill


--- begin sample setenv.bat ---

@echo off
echo Setting development environment for project X

rem
***************************************************************************
rem Change these for your system
rem
***************************************************************************
set VS_HOME=C:\Program Files\Microsoft Visual Studio .NET 2003
set SVN_HOME=C:\Program Files\Subversion

rem
***************************************************************************
rem Allow local override of the above variables
rem
***************************************************************************

IF EXIST setenv.local.cmd (
   call setenv.local.cmd
) ELSE (
   IF EXIST "%USERPROFILE%\setenv.x.cmd" (
      call "%USERPROFILE%\setenv.x.cmd"
   )
)


rem
***************************************************************************
rem You shouldn't have to change the items below
rem
***************************************************************************

set PROJ_ROOT=svn://svnserver/Products/Repositories/Products/X/trunk

set VC_HOME=%VS_HOME%\VC7

set WORKDIR=%~dp0%
set WORKDIR=%WORKDIR:~0,-1%
set DEVROOT=%WORKDIR%\Development
set TOOLS_ROOT=%WORKDIR%\Tools
set SIGNALSCAPE_ROOT=%DEVROOT%\Signalscape
set MICROSOFT_ROOT=%DEVROOT%\Microsoft
set INTEL_ROOT=%DEVROOT%\Intel
set PLATFORM_SDK_ROOT=%MICROSOFT_ROOT%\Platform_SDK\
set DIRECTX_SDK_ROOT=%MICROSOFT_ROOT%\DX90SDK
set
DIRECTSHOW_ROOT=%PLATFORM_SDK_ROOT%\Samples\Multimedia\DirectShow\BaseClasse
s
set STINGRAY_ROOT=%DEVROOT%\Rogue_Wave\Stingray_Studio
set LEAD_ROOT=%DEVROOT%\Lead\LTWIN10X
set NANT_HOME=%TOOLS_ROOT%\Nant
set NEWTEK_ROOT=%DEVROOT%\NewTek\VT4\SDK
set WIX_HOME=%TOOLS_ROOT%\WiX


set INCLUDE=
set LIB=

rem
***************************************************************************
rem Set the VS.NET environment
rem
***************************************************************************
call "%VS_HOME%\Common7\Tools\vsvars32.bat"

set OLDPATH=%PATH%
path=%SystemRoot%;%SystemRoot%\System32;
path=%PATH%;%CD%;%CD%\bin;%SVN_HOME%\bin;%NANT_HOME%\Bin;%MICROSOFT_ROOT%\HT
ML_Help_Workshop;
path=%PATH%;%PLATFORM_SDK_ROOT%\bin;%SIGNALSCAPE_ROOT%\SLS\bin;%WORKDIR%\Too
ls\bin;%WIX_HOME%;
path=%PATH%;%OLDPATH%
set OLDPATH=

set INCLUDE=%DIRECTX_SDK_ROOT%\Include
set INCLUDE=%INCLUDE%;%PLATFORM_SDK_ROOT%\Include
set INCLUDE=%INCLUDE%;%VC_HOME%\INCLUDE
set INCLUDE=%INCLUDE%;%VC_HOME%\ATLMFC\INCLUDE
set INCLUDE=%INCLUDE%;%VC_HOME%\PlatformSDK\INCLUDE
set INCLUDE=%INCLUDE%;%VC_HOME%\PlatformSDK\LIB
rem set INCLUDE=%INCLUDE%;%VC_HOME%\SDK\v1.1\include
set INCLUDE=%INCLUDE%;%STINGRAY_ROOT%\Include
set INCLUDE=%INCLUDE%;%DIRECTSHOW_ROOT%
set INCLUDE=%INCLUDE%;%MICROSOFT_ROOT%\WTL\Include
set INCLUDE=%INCLUDE%;%SIGNALSCAPE_ROOT%\SSATLEx\Include
set INCLUDE=%INCLUDE%;%INTEL_ROOT%\plsuite\include
set INCLUDE=%INCLUDE%;%DEVROOT%\Apex\Olectra 6.0.11
set INCLUDE=%INCLUDE%;%MICROSOFT_ROOT%\HTML_Help_Workshop\include
set INCLUDE=%INCLUDE%;%INTEL_ROOT%\Open_CV\ProgramFiles\CV\include
set INCLUDE=%INCLUDE%;%INTEL_ROOT%\Open_CV\ProgramFiles\CV\_include
set INCLUDE=%INCLUDE%;%LEAD_ROOT%\include
set INCLUDE=%INCLUDE%;%NEWTEK_ROOT%\include\Additional\RTVLib2


set LIB=%DIRECTX_SDK_ROOT%\Lib
set LIB=%LIB%;%PLATFORM_SDK_ROOT%\Lib
set LIB=%LIB%;%VC_HOME%\Lib
set LIB=%LIB%;%VC_HOME%\ATLMFC\Lib
set LIB=%LIB%;%VC_HOME%\PlatformSDK\Lib
rem set LIB=%LIB%;%VC_HOME%\SDK\v1.1\include
set LIB=%LIB%;%STINGRAY_ROOT%\Lib
set LIB=%LIB%;%DIRECTSHOW_ROOT%\Lib
set LIB=%LIB%;%INTEL_ROOT%\plsuite\lib\msvc
set LIB=%LIB%;%INTEL_ROOT%\plsuite\ia32\lib
set LIB=%LIB%;%INTEL_ROOT%\Open_CV\ProgramFiles\lib
set LIB=%LIB%;%LEAD_ROOT%\lib
set LIB=%LIB%;%NEWTEK_ROOT%\Lib

doskey vs=devenv /useenv $*

--- end sample setenv.bat ---




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to