CodeDom compile error 'Forms' is not a member of 'Windows' in Windows 8.1 RRS feed

  • Question

  • 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.

    Also, if I invoke a function with a messagebox, it does work in the InMemory exe in Windows 8.1. So why does that work and declaring a Form does not work?

    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
                    '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

    Thursday, January 16, 2014 3:12 PM

All replies

  • Hi,

    Could you show me the version of Visual Studio in windows 8.1? Is this a Visual Studio Express for Web?If so, you may need to consider getting a more expansive edition of the development environment.

    Or you should check the reference to System.Windows.Forms, and view the properties of System.Windows.Forms assembly in Object Broswer window.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 20, 2014 1:29 AM
  • Hi Marvin,

    Microsoft Visual Studio Professional 2012 Update 4

    The problem is not when creating applications in VS, it is when I am creating an in-memory .exe from my application using the CodeDom. The CodeDom compiles the script and then I invoke it from the main application. However Windows 8.1 doesn't allow for the script to contain 'Forms' anymore.

    Friday, January 24, 2014 2:09 PM