/
DevInstall.cmd
98 lines (72 loc) · 3.07 KB
/
DevInstall.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@ECHO OFF
ECHO.
ECHO.Usage: DevInstall.cmd [/u][/debug]
ECHO.
ECHO.This script requires Administrative privileges to run properly.
ECHO.Start > All Programs > Accessories> Right-Click Command Prompt > Select 'Run As Administrator'
ECHO.
set CompanyName=MediaBrowser
set AssemblyName=MediaBrowser
set RegistrationName=Registration
set ProgramImage=Application.png
ECHO.Determine whether we are on an 32 or 64 bit machine
if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86
set ProgramFilesPath=c:\Program Files
ECHO.
goto unregister
:x86
ECHO.On an x86 machine
set ProgramFilesPath=%ProgramFiles%
ECHO.
:unregister
ECHO.*** Unregistering and deleting assemblies ***
ECHO.
ECHO.Unregister and delete previously installed files (which may fail if nothing is registered)
ECHO.
ECHO.Unregister the application entry points
%windir%\ehome\RegisterMCEApp.exe /allusers "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\%RegistrationName%.xml" /u
ECHO.
ECHO.Remove the DLL from the Global Assembly cache
"%ProgramFilesPath%\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /u "%AssemblyName%"
ECHO.
ECHO.Delete the folder containing the DLLs and supporting files (silent if successful)
rd /s /q "%ProgramFilesPath%\%CompanyName%\%AssemblyName%"
rd /s /q "%ProgramFilesPath%\%CompanyName%
ECHO.
REM Exit out if the /u uninstall argument is provided, leaving no trace of program files.
if "%1"=="/u" goto exit
:releasetype
if "%1"=="/Debug" goto debug
set ReleaseType=Release
ECHO.
goto checkbin
:debug
set ReleaseType=Debug
ECHO.
:checkbin
if exist ".\bin\%ReleaseType%\%AssemblyName%.dll" goto register
ECHO.Cannot find %ReleaseType% binaries.
ECHO.Build solution as %ReleaseType% and run script again.
goto exit
:register
ECHO.*** Copying and registering assemblies ***
ECHO.
ECHO.Create the path for the binaries and supporting files (silent if successful)
md "%ProgramFilesPath%\%CompanyName%\%AssemblyName%"
ECHO.
ECHO.Copy the binaries to program files
copy /y ".\bin\%ReleaseType%\%AssemblyName%.dll" "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\"
ECHO.
ECHO.Copy the registration XML to program files
copy /y ".\%RegistrationName%.xml" "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\"
ECHO.
ECHO.Copy the program image to program files
copy /y ".\Images\%ProgramImage%" "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\"
ECHO.
ECHO.Register the DLL with the global assembly cache
"%ProgramFilesPath%\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" /if "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\%AssemblyName%.dll"
ECHO.
ECHO.Register the application with Windows Media Center
%windir%\ehome\RegisterMCEApp.exe /allusers "%ProgramFilesPath%\%CompanyName%\%AssemblyName%\%RegistrationName%.xml"
ECHO.
:exit