0

我正在使用 Janus Schedule dll(以及其他 Janus 引用,如 janus.common、janus.calendar.dll)将约会保存在 xml 文件中(我正在使用 Janus Winforsv

控制套件 v 3.0)。

我已经在我的电脑上成功运行了该应用程序,但是在其他电脑上运行程序时,程序在调用该SaveAppointments方法时失败,错误出现在Schedule1.SaveAppointments(stream) ...

方法是:

Private Sub SaveAppointments()
        Dim stream As System.IO.Stream
        If (fileName Is Nothing) Then
            If (saveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK) Then
                fileName = saveFileDialog1.FileName
                stream = saveFileDialog1.OpenFile()
            Else
                Return
            End If
        Else
            stream = New System.IO.FileStream(fileName, System.IO.FileMode.Create)
            stream.Position = 0

             Schedule1.SaveAppointments(stream)  ''*******HERE IS THE ERROR      

           stream.Close()

            stream = Nothing

            appointmentsChanged = False
        End If
    End Sub

我得到的错误是:

 System.TypeLoadException: Abstract Method with non-zero RVA    
at  Janus.Windows.Common.Layouts.PropertyValue.a(XmlWriter , IJanusLayout 
at Janus.Windows.Common.Layouts.JanusLayoutWriter.a(XmlWriter ,  IJanusLayout )    
at Janus.Windows.Common.Layouts.JanusLayoutWriter.FillStream(Stream  stream)
at Janus.Windows.Schedule.Schedule.SaveAppointments(Stream  stream)   
at FOEA.MainForm.SaveAppointments()
at C:\FOE\UI\MainForm.vb:línea 78    
at FOEA.MainForm.MainMenu_Click(Object sender, EventArgs e) 
at C:\FOEA\UI\MainForm.vb:line 143    
at  System.Windows.Forms.MenuItem.OnClick(EventArgs e)    
at System.Windows.Forms.MenuItem.MenuItemData.Execute()    
at System.Windows.Forms.Command.Invoke()    
at System.Windows.Forms.Command.DispatchID(Int32 id)    
at System.Windows.Forms.Control.WmCommand(Message& m)    
at System.Windows.Forms.Control.WndProc(Message& m)    
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)    
at System.Windows.Forms.ContainerControl.WndProc(Message& m)    
at System.Windows.Forms.Form.WndProc(Message& m)    
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

首先我怀疑目标PC需要.NET 3.5 Xml.linq.dll,但我引用了dll,然后我将Copy local分配给true,并添加了所有必要的dll,仍然抛出该错误......

其他猜测是System.Xml.dll 我的 bin 目录中的 dllSystem.XML.dll的名称(

我已经安装了:

  • Microsoft .NET 4 框架客户端配置文件
  • Microsoft .NET 4 框架扩展
  • MSXML 4.0 SP2 解析器和 SDK
  • MSXML 4.0 SP3 解析器

在目标电脑上,但那不起作用......当收到该错误时,xml文件的内容被删除,文件 schedule.xml 仍然存在并且为空。

我不知道该怎么做,因为该程序在我的电脑和其他我的电脑上运行,但没有在目标电脑上运行......你认为我应该在目标电脑上安装 Janus winforms 吗?也许那行得通

4

1 回答 1

1

我前段时间用过Janus。我使用的保存约会的方法是:

 Private Sub SaveAppointments()
        Me.Cursor = Cursors.WaitCursor
        Dim appointmentsDir As String = "yourAppsFile.xml"
        Dim appointmentsStream As System.IO.FileStream
        appointmentsStream = New System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create)
        Schedule1.SaveAppointments(appointmentsStream)
        appointmentsStream.Close()
        Me.Cursor = Cursors.Default
    End Sub

还要验证 xml 文件是否具有所有根和元素(格式良好的 XML)

在 Janus 3.5 中

<?xml version="1.0" encoding="utf-8"?>
<Schedule>
    <Fields Collection="true" ElementName="Field" />
    <Owners Collection="true" ElementName="Owner" />
    <Appointments Collection="true" ElementName="Appointment">
        <Appointment0>
            <Description>test </Description>
            <EndTime>10/10/2011 11:00:00</EndTime>
            <Text>test </Text>
            <StartTime>10/10/2011 10:30:00</StartTime>
        </Appointment0>           
    </Appointments>
</Schedule>
于 2012-12-21T18:32:49.963 回答