hello group,
for my VB.NET application I need a console app. to compile them.
But I get a MissingMethodException on the device / emulator.

The testproject is very simple:
- place one picturebox with an image on the form
- in form_load place: msgbox("Hello world")

If I compile it with VS it works fine.
If I compile it with my console app. the error occurs.
If I compile it with my console app. without the messagebox it works
fine.

Whats wrong ?

Here is my console app. code:
---------------------------------------------------------------------------------
...
Dim cdp As CodeDomProvider
cdp = New VBCodeProvider

Dim compiler As ICodeCompiler = cdp.CreateCompiler()
Dim cpParameters As CompilerParameters = New CompilerParameters
With cpParameters


.OutputAssembly = "resTest"

.GenerateExecutable = True
.MainClass = "resTest.frmStart"

.IncludeDebugInformation = False
.GenerateInMemory = False
.WarningLevel = 3
.TreatWarningsAsErrors = False
.TempFiles = New TempFileCollection("temp", True)

'// Resourcen angeben
strResourcen = "/resource:resTest.frmStart.resources "

'// Imports:
strImports = "Microsoft.VisualBasic,"
strImports &= "System,"
strImports &= "System.Data,"
strImports &= "System.Collections,"
strImports &= "System.Configuration,"
strImports &= "System.Drawing,"
strImports &= "System.Diagnostics,"
strImports &= "System.Windows.Forms"


.CompilerOptions = "/netcf /target:winexe
/rootnamespace:resTest /optimize /optionstrict- /optionexplicit+
/optioncompare:binary /recurse:test\*.vb " & strResourcen & "
/debug:full /imports:" & strImports

strPath = "c:\Programme\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows CE\"
.ReferencedAssemblies.Add(strPath & "mscorlib.dll")
.ReferencedAssemblies.Add(strPath &
"Microsoft.VisualBasic.dll")
.ReferencedAssemblies.Add(strPath & "System.dll")
.ReferencedAssemblies.Add(strPath & "System.Data.dll")
.ReferencedAssemblies.Add(strPath & "System.Drawing.dll")
.ReferencedAssemblies.Add(strPath &
"System.Windows.Forms.dll")
.ReferencedAssemblies.Add(strPath & "System.Xml.dll")
End With

Dim cr As CompilerResults =
compiler.CompileAssemblyFromSource(cpParameters, "")

----------------------------------------------------------------------------------

thanks wolfgang

Re: ICodeCompiler and Forms with Images by Sergey

Sergey
Mon Jan 16 01:24:29 CST 2006

There is no support of VBCodeProvider/ICodeCompiler for CF (see Version
Information in the link below):
http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.vbcodeprovider.createcompiler.aspx

Also it seems that you created the "Windows Application" instead of
"Smart Device Application".


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Wolfgang Link wrote:
> hello group,
> for my VB.NET application I need a console app. to compile them.
> But I get a MissingMethodException on the device / emulator.
>
> The testproject is very simple:
> - place one picturebox with an image on the form
> - in form_load place: msgbox("Hello world")
>
> If I compile it with VS it works fine.
> If I compile it with my console app. the error occurs.
> If I compile it with my console app. without the messagebox it works
> fine.
>
> Whats wrong ?
>
> Here is my console app. code:
> ---------------------------------------------------------------------------------
> ...
> Dim cdp As CodeDomProvider
> cdp = New VBCodeProvider
>
> Dim compiler As ICodeCompiler = cdp.CreateCompiler()
> Dim cpParameters As CompilerParameters = New CompilerParameters
> With cpParameters
>
>
> .OutputAssembly = "resTest"
>
> .GenerateExecutable = True
> .MainClass = "resTest.frmStart"
>
> .IncludeDebugInformation = False
> .GenerateInMemory = False
> .WarningLevel = 3
> .TreatWarningsAsErrors = False
> .TempFiles = New TempFileCollection("temp", True)
>
> '// Resourcen angeben
> strResourcen = "/resource:resTest.frmStart.resources "
>
> '// Imports:
> strImports = "Microsoft.VisualBasic,"
> strImports &= "System,"
> strImports &= "System.Data,"
> strImports &= "System.Collections,"
> strImports &= "System.Configuration,"
> strImports &= "System.Drawing,"
> strImports &= "System.Diagnostics,"
> strImports &= "System.Windows.Forms"
>
>
> .CompilerOptions = "/netcf /target:winexe
> /rootnamespace:resTest /optimize /optionstrict- /optionexplicit+
> /optioncompare:binary /recurse:test\*.vb " & strResourcen & "
> /debug:full /imports:" & strImports
>
> strPath = "c:\Programme\Microsoft Visual Studio .NET
> 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\"
> .ReferencedAssemblies.Add(strPath & "mscorlib.dll")
> .ReferencedAssemblies.Add(strPath &
> "Microsoft.VisualBasic.dll")
> .ReferencedAssemblies.Add(strPath & "System.dll")
> .ReferencedAssemblies.Add(strPath & "System.Data.dll")
> .ReferencedAssemblies.Add(strPath & "System.Drawing.dll")
> .ReferencedAssemblies.Add(strPath &
> "System.Windows.Forms.dll")
> .ReferencedAssemblies.Add(strPath & "System.Xml.dll")
> End With
>
> Dim cr As CompilerResults =
> compiler.CompileAssemblyFromSource(cpParameters, "")
>
> ----------------------------------------------------------------------------------
>
> thanks wolfgang
>

Re: ICodeCompiler and Forms with Images by Wolfgang

Wolfgang
Wed Jan 18 02:26:19 CST 2006

Thank you, but is there another chance to compile netcf code without
the VS Studio IDE ?
With a dos batch or other ... ?

regards wolfgang