Compile and create exe

G

Guest

Dear Experts,

I've completed my console application and now wants to compile the
application and an executable file to be run at another location. However,
I've tried compiling that program in the command prompt with the following
command :

vbc Module1.vb /out:OEAutomation.exe /t:exe

I received a lot of error messages.
-------------------------------------------------------------------------------------------
D:\OEAutomation\OEAutomation\Module1.vb(3) : error BC30466: Namespace or
type 'Mail' for the Imports 'System.Web.Mail' cannot be

Imports System.Web.Mail
~~~~~~~~~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(8) : error BC30002: Type 'SmtpMail'
is not defined.

Public smtp As SmtpMail
~~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(9) : error BC30002: Type
'MailMessage' is not defined.

Public msgOELog As MailMessage = New MailMessage()
~~~~~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(23) : error BC30002: Type 'clsFTP'
is not defined.

Dim ff As clsFTP
~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(24) : error BC30002: Type 'SmtpMail'
is not defined.

Dim smtpErrorToIT As SmtpMail
~~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(25) : error BC30002: Type
'MailMessage' is not defined.

Dim msgErrorMailToIT As MailMessage = New MailMessage()
~~~~~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(27) : error BC30451: Name 'Today' is
not declared.

dtCurrentDate = Today
~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(28) : error BC30451: Name 'Weekday'
is not declared.

If Weekday(dtCurrentDate) = 2 Then
~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(35) : error BC30451: Name 'Month' is
not declared.

strOEYesterdayLogFilename = "eoe" & Month(dtPreviousDate) &
Day(dtPreviousDate) & ".txt"
~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(35) : error BC30451: Name 'Day' is
not declared.

strOEYesterdayLogFilename = "eoe" & Month(dtPreviousDate) &
Day(dtPreviousDate) & ".txt"
~~~
D:\OEAutomation\OEAutomation\Module1.vb(36) : error BC30451: Name 'Month' is
not declared.

strOETodayLogFilename = "eoe" & Month(dtCurrentDate) &
Day(dtCurrentDate) & ".txt"
~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(36) : error BC30451: Name 'Day' is
not declared.

strOETodayLogFilename = "eoe" & Month(dtCurrentDate) &
Day(dtCurrentDate) & ".txt"
~~~
D:\OEAutomation\OEAutomation\Module1.vb(49) : error BC30451: Name 'vbLf' is
not declared.

msgOELog.Body = "Dear All," & vbLf & vbLf
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(49) : error BC30451: Name 'vbLf' is
not declared.

msgOELog.Body = "Dear All," & vbLf & vbLf
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(57) : error BC30451: Name 'Now' is
not declared.

objOutputLogFile.WriteLine(Now() & " Started")
~~~
D:\OEAutomation\OEAutomation\Module1.vb(61) : error BC30451: Name 'Now' is
not declared.

objOutputLogFile.WriteLine(Now() & " Started")
~~~
D:\OEAutomation\OEAutomation\Module1.vb(68) : error BC30451: Name 'Now' is
not declared.

objOutputLogFile.WriteLine(Now() & " Old Log Rename Successfully")
~~~
D:\OEAutomation\OEAutomation\Module1.vb(72) : error BC30451: Name 'Now' is
not declared.

objOutputLogFile.WriteLine(Now() & " Yesterday Old Log Rename
Successfully")
~~~
D:\OEAutomation\OEAutomation\Module1.vb(76) : error BC30002: Type 'clsFTP'
is not defined.

ff = New clsFTP()
~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(119) : error BC30451: Name 'vbCrLf'
is not declared.

objOutputLogFile.WriteLine("Specific Error=" & ex.Message +
vbCrLf)
~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(131) : error BC30451: Name 'Hour' is
not declared.

If Hour(Now()) = 9 Then
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(131) : error BC30451: Name 'Now' is
not declared.

If Hour(Now()) = 9 Then
~~~
D:\OEAutomation\OEAutomation\Module1.vb(149) : error BC30451: Name 'Hour' is
not declared.

If Hour(Now()) = 15 Then
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(149) : error BC30451: Name 'Now' is
not declared.

If Hour(Now()) = 15 Then
~~~
D:\OEAutomation\OEAutomation\Module1.vb(183) : error BC30451: Name 'vbLf' is
not declared.

msgOELog.Body = msgOELog.Body & dtDate & vbLf
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(198) : error BC30451: Name 'Replace'
is not declared.

arrFileContent(lngCounter) = Replace(arrFileContent(lngCounter),
strPipe, "|")
~~~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(207) : error BC30451: Name 'Len' is
not declared.

If Len(strTempString) = 0 Then
~~~
D:\OEAutomation\OEAutomation\Module1.vb(215) : error BC30451: Name 'Trim' is
not declared.

strTempString = Trim(strTempString)
~~~~
D:\OEAutomation\OEAutomation\Module1.vb(216) : error BC30451: Name 'InStr'
is not declared.

If InStr(1, strTempString, "TT") <> 0 Then
~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(217) : error BC30451: Name 'InStr'
is not declared.

ElseIf InStr(1, strTempString, "NOPAD") <> 0 Then
~~~~~
D:\OEAutomation\OEAutomation\Module1.vb(218) : error BC30451: Name 'InStr'
is not declared.

ElseIf InStr(1, strTempString, "Item") <> 0 Then
~~~~~
----------------------------------------------------------------------------------------------
And I've no idea how to perform an IDE compilation. I tried to copy the exe
from the /bin directory to another location to run but received error message
stating that

The dynamic link library mscoree.dll could not be found in the specified path

I:\OEAutomationlog;.;C:\WINNT\System32;C:\WINNT\System;C:\WINNT;C:\WINNT\System32;C:\WINNT\System32\Wbem

Can anybody please help me or guide me on this?

Many thanks in advance.
 
G

Greg Burns

Seok Bee said:
Namespace or type 'Mail' for the Imports 'System.Web.Mail' cannot be

You need to reference System.Web.dll if you are going to you System.Web.Mail
classes

vbc Module1.vb /out:OEAutomation.exe /t:exe /r:System.Web.dll
And I've no idea how to perform an IDE compilation. I tried to copy the
exe
from the /bin directory to another location to run but received error
message
stating that

What IDE are you using? VS.NET 2003? Use the Build menu.
The dynamic link library mscoree.dll could not be found in the specified
path

That error sounds like the one you get when you try to execute a .NET
application on a computer that doesn't have .NET installed.

Download and installed the redistrubatable package on the computer you want
to execute your app on.
http://www.microsoft.com/downloads/...e3-f589-4842-8157-034d1e7cf3a3&displaylang=en

Greg
 
G

Guest

Thanks a lot Greg for your fast reply.
I am using Visual Studio .NET 2002 with Service Pack 1.
I think the machine that I wants the program to be run has not been
installed with any .NET Framework component.
Also do I need to put in all the references that I have Import in the
programs when I perform the compilation?
Because I received error messages again after I include the System.Web.dll.
I have a class created in the program. How do I include the class when I
perform the compilation as the error message is showing that the class that I
declare is not defined.
 
G

Greg Burns

I don't believe VS.NET 2002 ever had a service pack, did it? You maybe
thinking of the .NET framework itself. The 1.0 framework is up to service
pack 3, and the 1.1 framework is up to service pack 1. At least I think
that is correct.

I would not bother trying to compile from the command prompt. If you have
the IDE you should take advantage of it!

Do you get any errors when you build your app inside of the IDE? If so,
what errors do you see in the Build Ouput window?

If not, then just build it (optionally changing your Active Solution
Configuraiton from Debug to Release mode) and copy the .exe from the bin
folder to the other machine.

References and Imports are NOT the same!

In order to use System.Web.Mail you must first have a reference to that
..dll. You do that inside the IDE by right-clicking References in Solution
Explorer and choosing Add Reference.

The Imports statement you add at the top of you class is optional.

Imports System.Web.Mail

This just allows you to not have to fully qualify the namespace. It just
saves you some typing.

Instead of having to type:
Dim ms As New System.Web.Mail.MailMessage

You can just type
Dim ms As New MailMessage

You can get away with the shorter name because you added the Imports
statement. Hope that is clear.

You must install .NET redistributable on any machine you want to run .NET
apps on.

Greg
 

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