Skip to main content

How to Create Zonal OCR MSI Installer

Prerequisite:

  • MSBuild and signtool should be present on machine
  • ZonalOCR project should contain all required dlls and should build without any errors

Steps:

  1. Open ZonalOCRInstaller project
  2. Navigate to appsettings.json and fill in next fields with correct values:

MsBuildPath - path to MSBuild.exe. It is required for building ZonalOCR project
SignToolPath - path to signtool.exe. It is required for signing ZonalOCR executable and an installer itself.
ZonalOcrSignKeystoreFile - keystore with certificate. It is required for signtool.exe
ZonalOcrSignKeystorePassword - keystore password. It is required for signtool.exe. You can find it in LastPass. Please do not commit the password to git. 
ZonalOcrVersionNumber - is displayed in the Programs and Features control panel. Make sure this matches the version number in the ZonalOCR project

For some cases default values of other parameters can be also changed:
TargetDirectory - default installation directory
ProjectName - it is used for msi file name (it will be <ProjectName>.msi)
ProjectPublisher - is displayed in the Programs and Features control panel
ZonalOcrSolutionFolder - path to the ZonalOCR solution
ZonalOcrSolutionFile - ZonalOCR solution file
ZonalOcrCompiledFolder - path where installer will find compiled and obfuscated binares
ZonalOcrExecutable - ZonalOCR executable file

appsettings.json exampe:

{
  "TargetDirectory": "%ProgramFiles%\\eFileCabinet\\ZonalOCR",
  "ProjectName": "eFileCabinet Zonal OCR",
  "ProjectPublisher": "eFileCabinet",
  "MsBuildPath" : "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe",
  "SignToolPath": "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\signtool.exe",
  "ZonalOcrSolutionFolder": "..\\..\\ZonalOCR",
  "ZonalOcrSolutionFile": "ZonalOCR.sln",
  "ZonalOcrCompiledFolder": "ZonalOCR\\bin\\ReleaseObfuscated",
  "ZonalOcrExecutable": "ZonalOCR.exe",
  "ZonalOcrSignKeystoreFile": "ZonalOCR\\efcKey.pfx",
  "ZonalOcrSignKeystorePassword": "salive.1",
  "ZonalOcrVersionNumber": "20.2.10.1"
}

  1. Build installer project. During the build <ProjectName>.msi will be created.

Troubleshooting:

Most problems encountered during the build will be related to MsBuildPath and SignToolPath. Verify that both executables exist at the specified paths.