We are trying to use Microsoft.Deployment.WindowsInstaller dll (C#) and install the MSI package. I couldn't find much examples regarding this. The installation is successfull. In case of error I want to display the error message in specific language using lcid. so I use the below method passing the error code. The MSI used has language English.
// Sample code for installing
try
{
Installer.InstallProduct(@"Sample.msi", "ALLUSERS=1 ADDLOCAL=ALL");
}
catch (InstallCanceledException ex)
{
errorList.Add(ex.ErrorCode + " " + ex.Message);
}
catch (InstallerException ex)
{
errorList.Add("Exit Code: " + ex.ErrorCode + ", " + ex.Message);
// Translate error message to different language
// ex.GetErrorRecord is always null,so the below method doesn't work.
string langError = Installer.GetErrorMessage(ex.GetErrorRecord(),System.Globalization.CultureInfo.GetCultureInfo(1031));
}
Am I using the method right? Please provide / point me to example where I can get the correct error message in specific language.
Thanks an lot in advance.