Vbc.exe using the command-line compiler and the csc.exe

Titlevbc: MSDN related
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/vblr7/html/valrfvbcompileroptionslistedbycategory.asp
csc: the MSDN related to
the use of C # 2.0 command-line compiler
will quote. vb compiled quote.dll file, use the command: vbc.exe, machine tops I use win server 2003 where the command path is:. C: \ WINDOWS \ Microsoft.NET \ Framework \ v1.1.4322. Into the above directory in DOS command symbol, quote.vb copy in the current directory, then the command vbc / t: library quote.vb, ok , compile, and then cut to the generated bin directory quote.dll (Description: / bin directory must be a direct subdirectory of your application root directory is \ wwwroot \ bin \ by default, but if your application is contained in a virtual directory, you must be in the virtual directory. created in the root directory / bin directory), for example, I built a virtual directory aspx, I will showquote.aspx exist /aspx/3/showquote.aspx, then I will put the quote.dll / aspx / bin / quote .dll, I'm out of some trouble in the control "ASP.NET technology insider," because the former library book more spaces, and vbc.exe directory is different.

Annex:
quote.vb 

None.gif Imports  System
None.gif
ExpandedBlockStart.gifContractedBlock.gif
Namespace myComponents Namespace myComponents
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
Public Class QuoteClass Quote
InBlock.gif
InBlock.gif
Dim myRand As New Random
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
Public Function ShowQuote()Function ShowQuote() As String
InBlock.gif
Select myRand.Next3 )
InBlock.gif
Case 0
InBlock.gif
Return "Look before you leap"
InBlock.gif
Case 1
InBlock.gif
Return "Necessity is the mother of invention"
InBlock.gif
Case 2
InBlock.gif
Return "Life is full of risks"
InBlock.gif
End Select
ExpandedSubBlockEnd.gif
End Function

InBlock.gif
ExpandedSubBlockEnd.gif
End Class

InBlock.gif
ExpandedBlockEnd.gif
End Namespace

None.gif
None.gif

showquote.aspx

ExpandedBlockStart.gif ContractedBlock.gif <% dot.gif @ Import Namespace="myComponents"  %>
None.gif
ExpandedBlockStart.gifContractedBlock.gif
< Script  Runat ="Server" > dot.gif
InBlock.gif
InBlock.gifSub Page_Load
InBlock.gifDim myQuote As New Quote
InBlock.gif
InBlock.giflblOutput.Text 
= myQuote.ShowQuote()
InBlock.gifEnd Sub
ExpandedBlockEnd.gif
None.gif
</ Script >
None.gif
None.gif
< html >
None.gif
< head >< title > ShowQuote.aspx </ title ></ head >
None.gif
< body >
None.gif
None.gifAnd the quote isdot.gif
None.gif
< br >
None.gif
< asp:Label
None.gif
id ="lblOutput"
None.gifRunat
="Server"   />
None.gif
None.gif
</ body >
None.gif
</ html >
None.gif


NOTES:

Visual Basic Language Concepts  

Sample Compilation Command Lines

As another method to compile the program from Visual Basic .NET in Visual Studio .NET, from the command line compiler to produce an executable (.exe) file or dynamic link library (.dll) file.

Visual Basic .NET command-line compiler supports the control input and output files, assemblies and complete set of options to debug and preprocessor options. Each option has two interchangeable forms are available: - the Option and / the Option . This document shows only / the Option form.

The following table lists some examples can be modified according to their needs command line.

To achieve operation please use
Compile and create File.vb File.exe vbc /reference:Microsoft.VisualBasic.dll File.vb
Compile File.vb and create File.dll vbc /target:library File.vb
Compile File.vb and create My.exe vbc /out:My.exe File.vb
Open to optimize and define the DEBUG symbol, all Visual Basic files in the current directory compiler to generate File2.exe vbc /define:DEBUG=1 /optimize /out:File2.exe *.vb
Compile all Visual Basic files in the current directory, generate debug version File2.dll and do not display a logo or a warning vbc /target:library /out:File2.dll /warn:0 /nologo /debug *.vb
将当前目录中的所有 Visual Basic 文件编译为 Something.dll vbc /target:library /out:Something.dll *.vb

在从命令行进行编译时,必须通过 /reference 编译器选项显式引用 Microsoft Visual Basic 运行时库。

请参见

Visual Basic 编译器选项 | 条件编译概述

 

Visual Basic 编译器选项  

按类别列出的 Visual Basic 编译器选项

Visual Basic .NET 命令行编译器可作为从 Visual Studio .NET 集成开发环境 (IDE) 中编译程序的另一种方法。以下是按功能类别排序的 Visual Basic 命令行编译器选项列表。

编译器输出

选项 目的
/nologo 不显示编译器版权标志信息。
/utf8output 使用 UTF-8 编码显示编译器输出。
/verbose 输出编译过程中的其他信息。

优化

选项 目的
/optimize 启用/禁用优化。

输出文件

选项 目的
/netcf 将编译器设置为面向 .NET Framework 精简版。
/out 指定输出文件。
/target 使用下列四个选项之一指定输出文件的格式:/target:exe/target:library/target:module/target:winexe

.NET 程序集

选项 目的
/addmodule 使编译器将指定文件中的所有类型信息对当前正在编译的项目可用。
/delaysign 指定程序集是完全签名的还是部分签名的。
/imports 由指定的程序集导入命名空间。
/keycontainer 指定密钥对的密钥容器名称以给予程序集强名称。
/keyfile 指定包含密钥或密钥对的文件以给予程序集强名称。
/libpath 通过 /reference 选项指定所引用程序集的位置。
/reference 从程序集导入元数据。

调试/错误检查

选项 目的
/bugreport 创建一个文件,该文件包含有助于报告错误的信息。
/debug 产生调试信息。
/nowarn 取消编译器生成警告的能力。
/quiet 防止编译器针对与语法相关的错误和警告显示代码。
/removeintchecks 禁用整数溢出检查。
/warnaserror 将警告提升为错误。

帮助

选项 目的
/? 显示编译器选项。此命令等同于指定 /help 选项。未进行编译。
/help 显示编译器选项。此命令等同于指定 /? 选项。未进行编译。

语言

选项 目的
/optionexplicit 要求显式声明变量。
/optionstrict 强制执行严格的类型语义。
/optioncompare 确定字符串比较是采用二进制格式还是使用区域设置规范文本语义。

预处理器

选项 目的
/define 定义用于条件编译的符号。

资源

选项 目的
/linkresource 创建到托管资源的链接。
/resource 将托管资源嵌入程序集。
/win32icon 将 .ico 文件插入到输出文件中。
/win32resource 将 Win32 资源插入到输出文件中。

杂项

选项 目的
@(指定响应文件) 指定响应文件。
/baseaddress 指定 DLL 的基址。
/main 指定包含启动时要使用的 Sub Main 过程的类。
/recurse 在子目录中搜索要编译的源文件。
/rootnamespace Specifies a namespace for all type declarations.
/sdkpath Specify the location of mscorlib.dll and microsoft.visualbasic.dll.

See

Visual Basic Compiler Options Listed Alphabetically of | "<project name> Property Pages" box

vbc: MSDN related
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS /vblr7/html/valrfvbcompileroptionslistedbycategory.asp


using C # 2.0 command-line compiler

Reproduced in: https: //www.cnblogs.com/Spring/archive/2005/03/25/125686.html

Guess you like

Origin blog.csdn.net/weixin_33756418/article/details/93932364