我们正在尝试使用Microsoft.Deployment.WindowsInstaller dll (C#)并安装MSI包。在这方面我找不到多少例子。安装是成功的。在出现错误的情况下,我希望使用lcid以特定语言显示错误消息。因此,我使用下面的方法传递错误代码。MSI使用的语言有英语。
// 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));
}我用的方法对吗?请提供/指出我的例子,在那里我可以得到正确的错误信息,以特定的语言。
提前谢谢。
https://stackoverflow.com/questions/32426744
复制相似问题