@ECHO OFF
REM ********************************************************************************
REM
REM This batch file will register the Visual Studio 2008 support for CodeSmith.
REM
REM NOTE: You must own a CodeSmith Professional license
REM 
REM These actions would be completed by the installer normally, but you may wish to
REM register them manually or use this to switch the Visual Studio support
REM between different versions of CodeSmith.
REM
REM NOTE: You may need to change the path to the FRAMEWORKDIR and FRAMEWORKSDKDIR
REM variables.
REM 
REM ********************************************************************************

@SET FRAMEWORKDIR=%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727
@SET VS9DIR=%PROGRAMFILES%\Microsoft Visual Studio 9.0
@SET FRAMEWORKSDKDIR=%PROGRAMFILES%\Microsoft SDKs\Windows\v6.0A\bin

@ECHO - Installing assemblies into the global assembly cache...

"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\bin\CodeSmith.Engine.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\bin\CodeSmith.Gui.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\AddIns\CodeSmith.BaseTemplates.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\AddIns\CodeSmith.CustomProperties.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\AddIns\SchemaExplorer.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\SchemaProviders\SchemaExplorer.SqlSchemaProvider.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\SchemaProviders\SchemaExplorer.ADOXSchemaProvider.dll
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /f /i ..\bin\CodeSmith.VisualStudio.Package.dll
IF NOT %ERRORLEVEL%==0 goto error

@ECHO - Installed assemblies into the global assembly cache successfully.
@ECHO.
@ECHO - Registering Visual Studio package...

reg import "vs2008-install.reg"

@ECHO - Updating Visual Studio setup...
"%VS9DIR%\Common7\IDE\devenv.exe" /setup

GOTO done
:error
@ECHO Non-zero return code %ERRORLEVEL%, script aborted.

:done
PAUSE