The script is as follows:
@echo off
@setlocal enableextensions @cd/d "%~dp0"
Set Installpath=c:\dboxservice\server set utiltoolpath=c:\windows\microsoft.net\framework\v2.0.50727
Echo Local installation folder-%installpath%
IF not EXIST "%installpath%" (MKDIR "%installpath%" ECHO Folder%installpath% created)
IF EXIST "%installpath%\dropboxwindowsservice.exe" (%utiltoolpath%\installutil.exe "%installpath%\ DropboxWindowsService.exe "/u ECHO unregistered Service:%installpath%\dropboxwindowsservice.exe)
echo Start to copy files to service folder
Copy DropboxWindowsService.exe "%installpath%" copy DropboxWindowsService.exe.config "%installpath%" copy DropboxCore.dll "%installpath%" copy Log4net.dll "%installpath%"
ECHO Program Files copied to%installpath%
%utiltoolpath%\installutil.exe "%installpath%\dropboxwindowsservice.exe" ECHO registered Service (%InstallPath%\ DropboxWindowsService.exe)
net start Dropboxwindowsservice
ECHO DropBox Windows Service installed on Server successfully!
Pause
There have been errors:
Uninstalling assembly ' C:\DBoxService\Server\DropboxWindowsService.exe '.
Affected parameters is:
LogtoConsole =
AssemblyPath = C:\DBoxService\Server\DropboxWindowsService.exe
LogFile = C:\DBoxService\Server\DropboxWindowsService.InstallLog
An exception occurred and trying to find the installers in the C:\DBoxService\Server\DropboxWindowsService.exe assembly.
System.Reflection.ReflectionTypeLoadException:Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for C:\DBoxService\Server\DropboxWindowsService.exe.
Installing assembly ' C:\DBoxService\Server\DropboxWindowsService.exe '.
This error occurs because the name of the DLL referenced in the project has changed, and the DLL inside the installation package has not changed, causing the error above.