-nostdlib (Visual Basic)-nostdlib (Visual Basic)
导致编译器不自动引用标准库。Causes the compiler not to automatically reference the standard libraries.
语法Syntax
-nostdlib
备注Remarks
-nostdlib
选项会删除对 System.dll 程序集的自动引用,并防止编译器读取 Vbc.rsp 文件。The -nostdlib
option removes the automatic reference to the System.dll assembly and prevents the compiler from reading the Vbc.rsp file. Vbc.rsp 文件(与 Vbc.exe 文件位于同一个目录)引用常用的 .NET Framework 程序集,并导入 System
和 Microsoft.VisualBasic
命名空间。The Vbc.rsp file, which is located in the same directory as the Vbc.exe file, references the commonly used .NET Framework assemblies and imports the System
and Microsoft.VisualBasic
namespaces.
备注
始终引用 Mscorlib.dll 和 Microsoft.VisualBasic.dll 程序集。The Mscorlib.dll and Microsoft.VisualBasic.dll assemblies are always referenced.
备注
-nostdlib
选项在 Visual Studio 开发环境内无法使用;仅当从命令行编译时才可用。The -nostdlib
option is not available from within the Visual Studio development environment; it is available only when compiling from the command line.
示例Example
下面的代码在不引用标准库的情况下编译 T2.vb
。The following code compiles T2.vb
without referencing the standard libraries. 必须将 _MYTYPE
条件编译常量设置为字符串“Empty”,才能删除 My
对象。You must set the _MYTYPE
conditional-compilation constant to the string "Empty" to remove the My
object.
vbc -nostdlib -define:_MYTYPE=\"Empty\" T2.vb