2
我使用CodeDom创建InMemory exe。这适用于Windows 8及更低版本。编译的代码在Windows 8.1中工作,如果我删除窗体声明,但我不想这样做。有任何想法吗? Windows 7 - 所有作品, Windows 8 - 所有作品, Windows 8.1 - 没有声明形式的作品。CodeDom编译错误'Forms'不是Windows 8.1中的'Windows'的成员
参考框架
provOptions.Add("CompilerVersion", "v4.0")
CodeDom中引用的程序:
vbParams.ReferencedAssemblies.Add("mscorlib.dll")
vbParams.ReferencedAssemblies.Add("System.dll")
vbParams.ReferencedAssemblies.Add("System.Windows.Forms.dll")
vbParams.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
vbParams.ReferencedAssemblies.Add("System.Data.dll")
vbParams.ReferencedAssemblies.Add("System.Xml.dll")
vbParams.ReferencedAssemblies.Add("System.Data.Linq.dll")
vbParams.ReferencedAssemblies.Add("System.Core.dll")
vbParams.ReferencedAssemblies.Add("System.Drawing.dll")
vbParams.ReferencedAssemblies.Add("System.Data.DataSetExtensions.dll")
的遵从代码(部分):
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Math
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Data.DataRow
Imports System.Linq
Imports System.Drawing
Imports System.Xml
Imports System.Collections
Namespace Evaluator
Public Module GlobalVariables
Public DialogBox As System.Windows.Forms.Form **(this crashes in windows 8.1)**
End Module
more code...
Public Class Evaluator
'EDITED 1/16/13 - Invoking this function will show the message
'box which is part of the Forms namespace
Public Function TestFunction() As Object
MessageBox.Show("Lorem ipsum dolor sit amet.")
End Function
End Class
End Namespace
没错......'Forms'不是Windows 8.1中'Windows'的成员。我自己不能说得更好...... –
让我觉得奇怪的是我可以使用Windows.Forms.Form创建一个应用程序,它在8.1上运行良好,但不能通过使用CodeDom提供程序的InMemory .exe运行。使用codedom时它是不同名称空间的成员吗? – TroyS
此外,如果我用一个消息框调用函数,它在Windows 8.1中的InMemory exe中工作。那么为什么这个工作和声明一个表格不起作用呢? – TroyS