@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 VS8DIR=%PROGRAMFILES%\Microsoft Visual Studio 8
@SET FRAMEWORKSDKDIR=%VS8DIR%\SDK\v2.0\Bin
@SET SHAREDLICENSESDIR=%PROGRAMFILES%\Common Files\XHEO\SharedLicenses

@ECHO - Uninstalling assemblies from the global assembly cache...

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

@ECHO - Uninstalled assemblies from the global assembly cache successfully.
@ECHO.
@ECHO - Uninstalling v3.2 publisher policies from the global assembly cache...

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

@ECHO - Uninstalled v3.2 publisher policies from the global assembly cache successfully.
@ECHO.
@ECHO - Unregistering assemblies for COM interop...

"%FRAMEWORKDIR%\regasm" /nologo /unregister ..\bin\CodeSmith.VisualStudio.CodeGenerators.dll
IF NOT %ERRORLEVEL%==0 goto error
@ECHO - Unregistered assemblies for COM interop successfully.

@ECHO - Unregistering Visual Studio package...
reg import "package-uninstall.reg"

@ECHO - Updating Visual Studio setup...
devenv.exe /setup

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

:done
PAUSE