1
我在i7 intel,Windows 7 Ultimate,VS2010 Ultimate中创建,构建和发布应用程序。 在这台机器上运行的应用程序使用代码。在另一台机器不工作,为什么。在此先感谢,ocaccy。C#应用程序发布后不工作,为什么?
if(!Directory.Exists("C:\\users"))
{
DirectoryInfo di=Directory.CreateDirectory("C:\\users");
}
IniFile ini=new IniFile("C:\\users\\monitoring_config.ini");
Error Message on created machine:
************** Exception text **************
System.NullReferenceException: Object reference not set to an instance of an object.
Local MonitorX.CommPort.Open()
Local MonitorX.Monitor.checkConfigINI()
Local MonitorX.Monitor.btn_Preferences_Click(Object sender, EventArgs e)
Local System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
Local System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
Local System.Windows.Forms.Control.WndProc(Message& m)
Local System.Windows.Forms.ButtonBase.WndProc(Message& m)
Local System.Windows.Forms.Button.WndProc(Message& m)
Local System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)..........................................................
它似乎像错误是与'MonitorX.CommPort.Open()' – 2013-05-08 05:22:25
有关,它将有助于查看所有与该方法有关的代码以及错误显示如何定义'MonitorX',只是好奇如果您正在编写C#为什么要使用IniFile这可以完成,但为什么不使用.net框架提供的内置配置文件..?System.NullReferenceException:未将对象引用设置为对象的实例。 '意思是你正试图使用和或者给一个对象指定一个值,但你没有正确创建一个'新'' – MethodMan 2013-05-08 05:24:12
的实例谢谢。 非常大;可能会通过电子邮件? – 2013-05-08 06:38:31