【发布时间】:2017-09-14 19:58:04
【问题描述】:
我在同一个解决方案下有两个 Windows 窗体应用程序。
A.EXE 框架是针对 x86 的 4.5.2。
B.EXE 框架是针对 x86 的 3.5。
从 A.EXE 中单击按钮我打开 B.EXE。
在 B.EXE 中有一个打印到 EPSON TMT81 的功能。
在 B.EXE 表单加载中,我初始化了 Printer 对象...
m_Printer = new ThermalPrinter();
ThermalPrinter 类:
string strLogicalName = "PosPrintTMT81";
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
try
{
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch (Exception ex)
{
string strErrorMsg = ex.Message.ToString()
+ "\n\nPlease rectify the error and try again.";
LogException(ex);
return strErrorMsg;
}
PosExplorer posExplorer = new PosExplorer(); 行返回错误...
System.TypeInitializationException 的类型初始化器 'Microsoft.PointOfService.Management.Explorer' 抛出异常。
【问题讨论】:
标签: c# winforms printing .net-4.0 .net-3.5