Quick Download Link
ArcGIS 9.3: Register, Unregister
ArcGIS 10.0 and higher: Register, Unregister
Note:
Contents
Why bother to install ArcSWAT manually?
Important Facts
So, most of the time, upgrading ArcSWAT only means updating these six .NET assemblies and SWAT executable file. Knowing this, it’s possible to upgrade ArcSWAT without normal installation. It could be done use following steps:
Extract ArcSWAT program files from installation file
There is a MSI file, namely SWAT_Install.msi, in the installation package downloaded from SWAT website. It contains all the files which will be copied to the installation folder. We will extract all the files from it.
Execute following command in cmd window.
msiexec /a [SWAT_Install.msi_path] /qb TARGETDIR=[extraction_folder_path]
Where
SWAT_Install.msi_path is the path to SWAT_install.msi
extraction_folder_path is the path to the extraction folder where the extracted files will be saved.
Following window will show up to display the progress.
Wait it to finish and all the files will be extracted to the given folder. The extracted files are around 567 MB.
A bat file could be used to do this work. Create a text file in the folder, copy following commands to the file and save it as a bat file in the same folder as the installation file. Then double-click to run the commands. This bat file also could be downloaded here.
msiexec /a SWAT_Install.msi /qb TARGETDIR=%CD%\extract
Copy new files to existing ArcSWAT installation folder
If a previous version is installed in the system, copy following files into the installation folder to replace the existing files.
Please note that the name of SWAT model executable files may be different for different version. There usually four versions: 32-bit debug, 32-bit release, 64-bit debug, 64-bit release.
Re-register ArcSWAT .NET assemblies
As mentioned in my previous post ArcSWAT Structure – Developer view, the ArcSWAT extension, toolbar, menus and windows are defined in six .NET assemblies. To use the new function in the new version, they must be registered in the system.
The register process is based on the version of ArcGIS.
Run cmd as administrator and navigate to .NET folder (which is usually located at c:\Windows\Microsoft.NET\Framework\v2.0.50727). Execute following command for each of the six ArcSWAT .NET assemblies. It’s done when you see “Type registered successfully”.
regasm [assembly_path] /codebase
where
assembly_path is the path to the ArcSWAT .NET assembly, e.g. c:\swat\ArcSWAT\SWAT_PM2.dll
The same as extracting files, a bat file could be created using following commands to do the work. An existing bat file could be downloaded here. Please not that the bat file needs to be in the same folder and run as administrator.
SET DLL_DIR=%~dp0
CD %SystemRoot%\Microsoft.NET\Framework\v2.0.50727
regasm %DLL_DIR%SWAT_HRUs.dll /codebase
regasm %DLL_DIR%SWAT_InputFileEdit.dll /codebase
regasm %DLL_DIR%SWAT_InputFileGen.dll /codebase
regasm %DLL_DIR%SWAT_PM2.dll /codebase
regasm %DLL_DIR%SWAT_RunSwat.dll /codebase
regasm %DLL_DIR%SWAT_WD.dll /codebase
Run cmd as administrator and navigate to ArcGIS bin folder (which is usually located at C:\Program Files (x86)\Common Files\ArcGIS\bin). Execute following command for each of the six ArcSWAT .NET assemblies. It’s done when you see a window saying “Registration succeeded”.
esriregasm /p:desktop
[assembly_path]
where
assembly_path is the path to the ArcSWAT .NET assembly, e.g. c:\swat\ArcSWAT\SWAT_PM2.dll
Similar as ArcGIS 9.3, a bat file could be utilized to do the work on just a click. Please note the location of esriregasm.exe may be different on your computer. For 32-bit system, it should be C:\Program Files\Common Files\ArcGIS\bin. Check the file location and modify this file before use if necessary.
SET DLL_DIR=%~dp0
CD C:\Program Files (x86)\Common Files\ArcGIS\bin
esriregasm /p:desktop %DLL_DIR%SWAT_HRUs.dll
esriregasm /p:desktop %DLL_DIR%SWAT_InputFileEdit.dll
esriregasm /p:desktop %DLL_DIR%SWAT_InputFileGen.dll
esriregasm /p:desktop %DLL_DIR%SWAT_PM2.dll
esriregasm /p:desktop %DLL_DIR%SWAT_RunSwat.dll
esriregasm /p:desktop %DLL_DIR%SWAT_WD.dll
Unregister previous ArcSWAT if necessary
If there is a previous version installed, it needs to be unregistered first. This process also depends on ArcGIS version.
Run cmd as administrator and navigate to .NET folder (which is usually located at c:\Windows\Microsoft.NET\Framework\v2.0.50727). Execute following command for each of the six ArcSWAT .NET assemblies. It’s done when you see “Type un-registered successfully”.
regasm [assembly_path] /unregister
where
assembly_path is the path to the ArcSWAT .NET assembly, e.g. c:\swat\ArcSWAT\SWAT_PM2.dll
A bat file is also available here with following commands, which should also be executed as administrator.
SET DLL_DIR=%~dp0
CD %SystemRoot%\Microsoft.NET\Framework\v2.0.50727
regasm %DLL_DIR%\SWAT_HRUs.dll /unregister
regasm %DLL_DIR%\SWAT_InputFileEdit.dll /unregister
regasm %DLL_DIR%\SWAT_InputFileGen.dll /unregister
regasm %DLL_DIR%\SWAT_PM2.dll /unregister
regasm %DLL_DIR%\SWAT_RunSwat.dll /unregister
regasm %DLL_DIR%\SWAT_WD.dll /unregister
Run cmd as administrator and navigate to ArcGIS bin folder (which is usually located at C:\Program Files (x86)\Common Files\ArcGIS\bin). Execute following command for each of the six ArcSWAT .NET assemblies. It’s done when you see a window saying “Unregistration succeeded”.
esriregasm /p:desktop /u
[assembly_path]
where
assembly_path is the path to the ArcSWAT .NET assembly, e.g. c:\swat\ArcSWAT\SWAT_PM2.dll
Similarly, a bat file could be used.
SET DLL_DIR=%~dp0
CD C:\Program Files (x86)\Common Files\ArcGIS\bin
esriregasm /p:desktop /u %DLL_DIR%SWAT_HRUs.dll
esriregasm /p:desktop /u %DLL_DIR%SWAT_InputFileEdit.dll
esriregasm /p:desktop /u %DLL_DIR%SWAT_InputFileGen.dll
esriregasm /p:desktop /u %DLL_DIR%SWAT_PM2.dll
esriregasm /p:desktop /u %DLL_DIR%SWAT_RunSwat.dll
esriregasm /p:desktop /u %DLL_DIR%SWAT_WD.dll