Pregunta

I am using CodeDom to create InMemory exe. This works great for Windows 8 and below. The compiled code works in Windows 8.1 if I remove the Forms Declaration, but i dont want to do that. Any ideas? Windows 7 - All works, Windows 8 - All works, Windows 8.1 - Works without declaring forms.

Referenced Framework

        provOptions.Add("CompilerVersion", "v4.0")

CodeDom referenced assemblies:

        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")

The complied code (partial):

        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
¿Fue útil?

Solución

As HighCore stated in the comment (That's right... Forms is not a member of Windows in Windows 8.1. I couldn't have said it better myself... –).

So what I did was put all the controls on a panel instead (in the In-Memory .exe) and then passed it back to the calling application and displayed the panel there instead. Worked out well.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top