Creating a VB.NET Windows application using the command line

Juanito27 posted this question to the VB.NET forum on GotDotNet last week…

Command line compile Windows vb app
I need to have someone show me how to compile via command line a vb.net windows app. Could someone show me the minimum code to get a window/form up with maybe a label or button on it.

so I posted up a sample to the samples page on my personal site that shows creating two programs via the VB.NET command line compiler… first a console application, then a Windows Forms app… this page is a draft version of something I’m putting together for MSDN so let me know if you find it useful…

Author: Duncan Mackenzie

I'm the Developer Lead for the Channel 9 team, formerly worked on MSDN as a developer, content strategist and author.

14 thoughts on “Creating a VB.NET Windows application using the command line”

  1. Hi

    Great article. Really informative and simply…. What about having a table of available command line arguments with descriptions and examples when and why you would use each og them, or are there too many?

    Cheers.

  2. If you have multiple forms, just add each .vb file onto your command line (vbc.exe form1.vb form2.vb form3.vb)…. yep, devenv.exe works wonders but I was assuming that you don’t have access to Visual Studio in this case.

  3. Hallo
    Can someone help me to show on how to compile a vb.net file using the command line. I am a very basic beginner working on this compilation process. Help me out on how to do it, the commands to do it and where should I type the commands.

    Looking forward to your help. Thanks in advance.

    Please mail to raja@gunasekaran.net

  4. I messed up my VS.net VB part – so I had to compile my ASP.net app from CMD prompt:

    1. Edit the PATH environment variable to include C:\WINNT\Microsoft.NET\Framework\v1.1.4322

    2. browse to your webapp directory:
    cd Inetpub\wwwroot\VoucherInvoice

    3. The execute following (instead of linebreaks – use spaces):

    vbc
    /recurse:*.vb
    /t:library
    /rootnamespace:VoucherInvoice
    /out:bin/VoucherInvoice.dll

    /r:System.dll
    /r:System.Web.dll
    /r:Microsoft.VisualBasic.dll
    /r:System.XML.dll
    /r:System.Data.dll
    /r:System.Drawing.dll

    /r:bin/ML_controls.dll
    /r:bin/ML_DataAccess.dll
    /r:bin/MetaBuilders.WebControls.DefaultButtons.dll

    /imports:System,System.Data,System.Data.SqlClient,System.Configuration,System.Drawing,
    System.Web,System.Web.UI,System.Web.SessionState,System.Web.UI.WebControls,
    System.Web.UI.HtmlControls,Microsoft.VisualBasic

  5. i wanna use System.Web.UI features in windows application.For Eg,
    In web application, its possible to convert memory stream into a PDF.
    How will i do thet in windows application.
    Can anyone guide me??

  6. Hello,

    Is there a way to determine the command-line equilvalent for an existing Visual Studio project?

    This would be useful for automaticing release builds.

Leave a Reply