Manually Install ArcSWAT

Quick Download Link

Extract Installation File

ArcGIS 9.3: Register, Unregister

ArcGIS 10.0 and higher: Register, Unregister

Note:

  1. The bat file needs to be saved in the same folder as installation file or .NET assemblies.
  2. The register and unregister bat file needs to be run as administrator.
  3. Since there will be some errors, the method in this post could also be used to install ArcSWAT for ArcGIS 10.0/10.1 on ArcGIS 9.3. 

Contents

  • Why bother to install ArcSWAT manually?
  • Important Facts
  • Extract ArcSWAT program files from installation file
  • Copy new files to existing ArcSWAT installation folder
  • Re-register ArcSWAT .NET assemblies
  • Unregister previous ArcSWAT if necessary

Why bother to install ArcSWAT manually?

  1. ArcSWAT is updated frequently and must be re-installed to use the new functions. Uninstalling the previous version and installing the new version would need around ten minutes.
  2. You may experience problems when trying to uninstall and install ArcSWAT. These problems are usually difficult to solve. Having seen some these problems in ArcSWAT user group. In some cases, it couldn’t be solved until restore the entire Windows system.

Important Facts

  1. There are usually two steps involved in program installation: 1) copy files to specific folder and 2) register some file in the system if necessary.
  2. The core of ArcSWAT is six .NET assemblies and SWAT executable file. When a new version comes out, it means one or more of these assemblies are updated. Other files are usually kept same between different versions. Of course, they would be updated once a while.

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:

  1. Get the core files
  2. Replace old files
  3. Re-register the six .NET assemblies

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.

  • SWAT_PM2.dll
  • SWAT_WD.dll
  • SWAT_HRU.dll
  • SWAT_InputFileGen.dll
  • SWAT_InputFileEdit.dll
  • SWAT_RunSWAT.dll
  • SWAT_32debug.exe
  • SWAT_32rel.exe
  • SWAT_64debug.exe
  • SWAT_64rel.exe
  • swat2012.exe

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.

  • ArcGIS 9.3

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

  • ArcGIS 10.0 and higher

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.

  • ArcGIS 9.3

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

  • ArcGIS 10.0 and higher

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

One Reply to “Manually Install ArcSWAT”

  1. Thanks for ones marvelous posting! I genuinely enjoyed reading it, you can be a great author.I will be sure to bookmark your blog and may come back later on. I want to encourage yourself to continue your great writing, have a nice weekend!

Leave a Reply to Eugene Aloia Cancel reply