Results 1 to 4 of 4

Thread: CommandLine Compile Console Application: How To ?

  1. #1

    Thread Starter
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551

    CommandLine Compile Console Application: How To ?

    Hey Cander,

    I've been researching on how I can compile simple vb.net console with the commandline compiler... To write a computing contest at my school, i need to bring in a pc to code with. The laptop that i own is an ancient 233 mhz, 32mb ram machine, so i've given up hope of running vs.net on that machine...

    Really, my only other option is to code in notepad, install the .NET framework on that machine, and use the command-line compiler to compile the .vb files i make...

    So far, this is what i have in my console .vb file:

    VB Code:
    1. Module HelloWorld
    2.  
    3.     Sub Main()
    4.         Console.WriteLine("Hello World!")
    5.     End Sub
    6.  
    7. End Module

    This is what vs.net spits out for a vb.net console app, but obviously vs.net does something else behind the scenes...

    i'm trying to compile it like this:

    vbc.exe D:\MyProgram.vb D:\MyProgram.exe

    It spits out bunch of errors...

    so my question is, how do i do this? am i writing the coding wrong? could someone please set me up a simple hello world console coding and the way that i would compile it?

    I appreciate the help!

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    It looks like you have done right I just tested what you did and it worked. The only thing I had to do was to add an imports statement as it doesn't find the console object otherwize.

    Code:
    Imports System
    Module Snabel
        Sub main()
    	Console.WriteLine("Snabel")
        End Sub
    End Module
    You should write "vbc.exe name.vb" instead of adding the exe thing after, because else it tries to find the specified exe.

  3. #3

    Thread Starter
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    cool, that works.. but the exe gets put in the folder where vbc.exe resides (naturally) .. is there any way to specify another location to write the exe file to?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    /out:c:\blah\blah.exe
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width