Complie From Cmd Line

P

pmclinn

Let's say I have the code below, and I want to complie this on a
machine that does not have VS2003 installed on it, but does have the
..net framework... Is it possible to complie this code below, and if so
how?

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtHello As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.txtHello = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'txtHello
'
Me.txtHello.Location = New System.Drawing.Point(32, 96)
Me.txtHello.Name = "txtHello"
Me.txtHello.Size = New System.Drawing.Size(224, 20)
Me.txtHello.TabIndex = 0
Me.txtHello.Text = ""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.txtHello)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtHello.Text = "Hello IT personal"
End Sub
End Class
 
C

Crouchie1998

You need the 'VBC.exe' program which comes with the .NET Framework SDK to be
able to compile it from the command line

See:

..NET Framework 1.1 SDK:

Page:
-----

http://www.microsoft.com/downloads/...familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d

Direct Download:
-----------------

http://download.microsoft.com/download/5/2/0/5202f918-306e-426d-9637-d7ee26fbe507/setup.exe

(108757 KB)

Command Line Compiling:
--------------------------

http://msdn.microsoft.com/library/d...y/en-us/vblr7/html/vaconVBCompilerOptions.asp

http://msdn.microsoft.com/library/d...y/en-us/vblr7/html/vaconVBCompilerOptions.asp

I hope this gives you the general Idea

Crouchie1998
BA (HONS) MCP MCSE
 
H

Herfried K. Wagner [MVP]

pmclinn said:
Let's say I have the code below, and I want to complie this on a
machine that does not have VS2003 installed on it, but does have the
.net framework... Is it possible to complie this code below, and if so
how?

Public Class Form1
Inherits System.Windows.Forms.Form
[...]

Command-line for the "vbc.exe" command-line compiler:

'vbc main.vb /main:Form1
/libpath:C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
/r:Microsoft.VisualBasic.d
ll /r:System.dll /r:System.Windows.Forms.dll /r:System.Drawing.dll
/imports:Syst
em /imports:System.Drawing /imports:System.Windows.Forms /target:winexe
/out:bla
..exe'
 
D

Dragon

You need the 'VBC.exe' program which comes with the .NET Framework SDK
to be
able to compile it from the command line

Hmm?

vbc comes just with .NET Framework Redistributable, doesn't it?

Roman
 
H

Herfried K. Wagner [MVP]

Dragon said:
vbc comes just with .NET Framework Redistributable, doesn't it?

Yes, "vbc" is included in the .NET Framework too. You don't need to install
the SDK in order to use "vbc".
 
C

Crouchie1998

According to the MSDN website it comes with the .NET Framework 1.1 SDK for
example.

Go to the MSDN site & search for 'vbc.exe' & it will tell you there.

Crouchie1998
BA (HONS) MCP MCSE
 
P

pmclinn

This is completely awesome. Thank you Herfried, for writing a custom
cmd line string for me. It was just the example I needed to complie my
code. Without the sdk installed I also had to spell out the path to
the vbc.exe in qoutes to make this work but it compiled without issue.


Is there any security concerns around this vbc.exe from being on all
clients on a network that is using the .net framework structure? I
guess permissions on this file should really locked down.

-Peter
 
C

Crouchie1998

I doubt if he wrote it for you & just copied/pasted it from the MSDN site.

Its hardly brain surgery though

Crouchie1998
BA (HONS) MCP MCSE
 
H

Herfried K. Wagner [MVP]

Crouchie1998 said:
I doubt if he wrote it for you & just copied/pasted it from the MSDN site.

Huh? No, I wrote it on my own (I have rarely done that and it took me some
minutes to do that... :-/). The MSDN documentation on "vbc.exe" contains
only very basic sample command-lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top