@ECHO OFF
REM ********************************************************************************
REM
REM This batch file will unregister the Visual Studio 2005 support for CodeSmith.
REM 
REM These actions would be completed by the installer normally, but you may wish to
REM unregister 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 - Uninstalling assemblies from the global assembly cache...

"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "CodeSmith.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "CodeSmith.Gui, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "CodeSmith.BaseTemplates, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "CodeSmith.CustomProperties, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "SchemaExplorer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "SchemaExplorer.SqlSchemaProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "SchemaExplorer.ADOXSchemaProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error
"%FRAMEWORKSDKDIR%\gacutil" /nologo /u "CodeSmith.VisualStudio.Package, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fd61cdb91609a7a"
IF NOT %ERRORLEVEL%==0 goto error

@ECHO - Uninstalled assemblies from the global assembly cache successfully.
@ECHO.
@ECHO - Unregistering Visual Studio package...

reg import "vs2008-uninstall.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