PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework ICodeCompiler and Forms with Images

Reply

ICodeCompiler and Forms with Images

 
Thread Tools Rate Thread
Old 16-01-2006, 07:03 AM   #1
Wolfgang Link
Guest
 
Posts: n/a
Default ICodeCompiler and Forms with Images


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

  Reply With Quote
Old 16-01-2006, 07:24 AM   #2
Sergey Bogdanov
Guest
 
Posts: n/a
Default Re: ICodeCompiler and Forms with Images

There is no support of VBCodeProvider/ICodeCompiler for CF (see Version
Information in the link below):
http://msdn2.microsoft.com/en-us/li...tecompiler.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
>

  Reply With Quote
Old 18-01-2006, 08:26 AM   #3
Wolfgang Link
Guest
 
Posts: n/a
Default Re: ICodeCompiler and Forms with Images

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

regards wolfgang

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off