none
VBCodeProvider

    Question

  • hi,
     Does microsoft have documentation on how to use VBCodeProvider and codedom or any .net book that provide detail on how to use it. i tried to use it to compile program on the fly but never work. It always gives me an errors such as path to the string or file not found.
    please if you have any idea on textbook or place that i can get detail, let me know

    thanks
    kaymaf
    Wednesday, February 04, 2009 2:39 AM

Answers

All replies

  • I had written some code

    http://social.technet.microsoft.com/Forums/en-US/vblanguage/thread/5877c246-66d1-48ab-9d5a-34fb428f311c/

    http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/686e5445-90fa-4c9f-9a0b-ad056622df39/

    Arjun Paudel
    • Marked as answer by kaymaf Thursday, February 05, 2009 5:54 AM
    Wednesday, February 04, 2009 4:45 AM
  • Thanks paudel, i will try the link you provides may be i will get solution to my problem
    kaymaf
    Wednesday, February 04, 2009 9:56 PM
  • thanks again Paudel, i followed your sample, my question now is that how can i compile more than one source file at the same time. For example, if have template1.txt ,template2.txt or more. So  how do i compile them together as Form1, Form 2. Below code only compile a single source file

     Dim errors As System.CodeDom.Compiler.CompilerResults = provider.CompileAssemblyFromFile(cp, Application.StartupPath & "\template.txt") 
    thanks
    kaymaf

    • Marked as answer by kaymaf Thursday, February 05, 2009 1:15 AM
    • Unmarked as answer by kaymaf Thursday, February 05, 2009 5:54 AM
    Thursday, February 05, 2009 1:14 AM
  • Why you marked your question as answered?

    If you want to compile all the files in a folder (remove cp.MainClass = "Form1")
    cp.CompilerOptions = "C:\myvbfiles\*.vb /target:winexe"

    if you want a single designer file to include then

    provider.CompileAssemblyFromFile(cp,    "C:\myvbfiles\Form1.vb")
    cp.CompilerOptions = "C:\myvbfiles\Form1.designers.vb /target:winexe"

    if you want selected file to compile then


    cp.CompilerOptions = "C:\myvbfiles\Form1.designers.vb C:\myvbfiles\From1.vb C:\myvbfiles\Form2.vb C:\myvbfiles\From2.designers.vb /target:winexe"

    This is excerpt from

    http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/686e5445-90fa-4c9f-9a0b-ad056622df39/

    Did you check that?


    Arjun Paudel
    • Marked as answer by kaymaf Thursday, February 05, 2009 5:54 AM
    Thursday, February 05, 2009 3:23 AM
  • thanks paudel for this vital information
    • Marked as answer by kaymaf Thursday, February 05, 2009 5:54 AM
    • Unmarked as answer by kaymaf Thursday, February 05, 2009 5:54 AM
    Thursday, February 05, 2009 5:54 AM
  • thanks again paudel,
    i found the simple way of doing it. I copied all the source code from each FORM and put them together as one source file. and it works .
    kaymaf
    Thursday, February 05, 2009 10:19 PM
  • hi
    Is me again,  I got problem with this icon file. Im try to add icon file with the output but im getting an error message below

    Error creating Win32 resources: Error reading icon '"C:\Documents and Settings\ADEBOMBER\Desktop\CompilerVB2005\CompilerVB2005\bin\Debug\gr2.ico"' -- The filename, directory name, or volume label syntax is incorrect.

    Dim iconFile As String Application.StartupPath & "\gr2.ico"


    I put my icon file in the bin directory, i dont know why im getting error

    the code below work with VB.NET 2003
     Options.CompilerOptions = "/target:winexe" '+ " " + "/win32icon:" + """" + iconFile + """"

    code below work in C#2005
    Options.CompilerOptions = "/target:winexe" + " " + "/win32icon:" + "\"" + pathtoicon + " \ "";

    Then i tried all these code below with VB2005 and non of them work. Im working with VB2005
    [C#2005]
    Options.CompilerOptions = "/target:winexe" + " " + "/win32icon:" + "\"" + iconfile + " \ "" 
    [VB2003]
    Options.CompilerOptions = "/target:winexe" & " " & "/win32icon:" & """" & iconFile & """"  Options.CompilerOptions = "/target:winexe" + " " + "/win32icon:" + """" + iconFile + """" 

    Again this is the error below:
    Error creating Win32 resources: Error reading icon '"C:\Documents and Settings\ADEBOMBER\Desktop\CompilerVB2005\CompilerVB2005\bin\Debug\gr2.ico"' -- The filename, directory name, or volume label syntax is incorrect.

    can you please take a look at the syntax, i dont know what the problem may be. i use them in vb2003 and c#2005 and it works.

    thanks
    kaymaf

    Friday, February 06, 2009 12:53 AM
  • I read about the problem of  "/win32icon:" on the web, someone  said that the problem is a bug with vb2005. I dont know if that is true, but it look like a bug because it works with vb2003 and all C# version.
     Please any suggestion or hint. I dont want to convert the program to C# then later know that the problem is a fixable

    thanks
    kaymaf
    Friday, February 06, 2009 2:48 AM
  • hi,
    i converted the project back to C#. so im done with the icon problem.

    thanks paudel

    kaymaf
    Tuesday, February 10, 2009 7:57 PM
  • hi Paudel

    i tried to compile the assemblyInfo.vb with the project but it doesnt work. if have any ideas or hints let me know.

    thanks

    kaymaf

    Friday, February 27, 2009 3:06 AM
  • thanks to all

    i finally got the problem solve.
    • Marked as answer by kaymaf Saturday, February 28, 2009 5:09 PM
    Saturday, February 28, 2009 5:08 PM