Repository navigation
Added two Visual Basic command-line switches #4733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| title: "-refonly (Visual Basic)" | ||
| ms.date: 03/16/2018 | ||
| ms.prod: .net | ||
| ms.technology: | ||
| - "devlang-visual-basic" | ||
| ms.topic: "article" | ||
| f1_keywords: | ||
| - "-refonly" | ||
| helpviewer_keywords: | ||
| - "/refonly compiler option [Visual Basic]" | ||
| - "-refonly compiler option [Visual Basic]" | ||
| - "refonly compiler option [Visual Basic]" | ||
| author: "rpetrusha" | ||
| ms.author: "ronpet" | ||
| --- | ||
|
|
||
| # -refonly (Visual Basic) | ||
|
|
||
| The **-refonly** option indicates that the primary output of the compilation should be a reference assembly instead of an implementation assembly. The `-refonly` parameter silently disables outputting PDBs, as reference assemblies cannot be executed. | ||
|
|
||
| [!INCLUDE[compiler-options](~/includes/compiler-options.md)] | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```console | ||
| -refonly | ||
| ``` | ||
|
|
||
| ## Remarks | ||
|
|
||
| Visual Basic supports the `-refout` switch starting with version 15.3. | ||
|
|
||
| Reference assemblies are metadata-only assemblies that contain metadata but no implementation code. They include type and member information for everything except anonymous types. The reason for using `throw null` bodies (as opposed to no bodies) is so that PEVerify could run and pass (thus validating the completeness of the metadata). | ||
|
|
||
| Reference assemblies include an assembly-level [ReferenceAssembly](xref:System.Runtime.CompilerServices.ReferenceAssemblyAttribute) attribute. This attribute may be specified in source (then the compiler won't need to synthesize it). Because of this attribute, runtimes will refuse to load reference assemblies for execution (but they can still be loaded in a reflection-only context). Tools that reflect on assemblies need to ensure they load reference assemblies as reflection-only; otherwise, the runtime throws a <xref:System.BadImageFormatException>. | ||
|
|
||
| The `-refonly` and [`-refout`](refout-compiler-option.md) options are mutually exclusive. | ||
|
|
||
| ## See also | ||
| [-refout](refout-compiler-option.md) | ||
| [Visual Basic Command-Line Compiler](index.md) | ||
| [Sample Compilation Command Lines](sample-compilation-command-lines.md) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| title: "-refout (Visual Basic)" | ||
| ms.date: 03/16/2018 | ||
| ms.prod: .net | ||
| ms.technology: | ||
| - "devlang-visual-basic" | ||
| ms.topic: "article" | ||
| f1_keywords: | ||
| - "/refout" | ||
| helpviewer_keywords: | ||
| - "refout compiler option [Visual Basic]" | ||
| - "/refout compiler option [Visual Basic]" | ||
| - "-refout compiler option [Visual Basic]" | ||
| author: "rpetrusha" | ||
| ms.author: "ronpet" | ||
| --- | ||
|
|
||
| # -refout (Visual Basic) | ||
|
|
||
| The **-refout** option specifies a file path where the reference assembly should be output. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reference the compiler-options.md file here. |
||
| [!INCLUDE[compiler-options](~/includes/compiler-options.md)] | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```console | ||
| -refout:filepath | ||
| ``` | ||
|
|
||
| ## Arguments | ||
|
|
||
| `filepath` | ||
| The path and filename of the reference assembly. It should generally be in a sub-folder of the primary assembly. The recommended convention (used by MSBuild) is to place the reference assembly in a "ref/" sub-folder relative to the primary assembly. All folders in `filepath` must exist; the compiler does not create them. | ||
|
|
||
| ## Remarks | ||
|
|
||
| Visual Basic supports the `-refout` switch starting with version 15.3. | ||
|
|
||
| Reference assemblies are metadata-only assemblies that contain metadata but no implementation code. They include type and member information for everything except anonymous types. Their method bodies are replaced with a single `throw null` statement. The reason for using `throw null` method bodies (as opposed to no bodies) is so that PEVerify can run and pass (thus validating the completeness of the metadata). | ||
|
|
||
| Reference assemblies include an assembly-level [ReferenceAssembly](xref:System.Runtime.CompilerServices.ReferenceAssemblyAttribute) attribute. This attribute may be specified in source (then the compiler won't need to synthesize it). Because of this attribute, runtimes refuse to load reference assemblies for execution (but they can still be loaded in a reflection-only context). Tools that reflect on assemblies need to ensure they load reference assemblies as reflection-only; otherwise, the runtime throws a <xref:System.BadImageFormatException>. | ||
|
|
||
| The `-refout` and [`-refonly`](refonly-compiler-option.md) options are mutually exclusive. | ||
|
|
||
| ## See Also | ||
| [-refonly](refonly-compiler-option.md) | ||
| [Visual Basic Command-Line Compiler](index.md) | ||
| [Sample Compilation Command Lines](sample-compilation-command-lines.md) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,9 +18,9 @@ author: rpetrusha | |
| ms.author: ronpet | ||
| --- | ||
| # Sample compilation command lines (Visual Basic) | ||
| As an alternative to compiling [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] programs from within [!INCLUDE[vsprvs](~/includes/vsprvs-md.md)], you can compile from the command line to produce executable (.exe) files or dynamic-link library (.dll) files. | ||
| As an alternative to compiling Visual Basic programs from within [!INCLUDE[vsprvs](~/includes/vsprvs-md.md)], you can compile from the command line to produce executable (.exe) files or dynamic-link library (.dll) files. | ||
|
|
||
| The [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] command-line compiler supports a complete set of options that control input and output files, assemblies, and debug and preprocessor options. Each option is available in two interchangeable forms: `-option` and `/option`. This documentation shows only the `-option` form. | ||
| The Visual Basic command-line compiler supports a complete set of options that control input and output files, assemblies, and debug and preprocessor options. Each option is available in two interchangeable forms: `-option` and `/option`. This documentation shows only the `-option` form. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Since we've merged the PR with the compiler-options.md file for options, do you want to use that here? |
||
|
|
||
| The following table lists some sample command lines you can modify for your own use. | ||
|
|
||
|
|
@@ -29,14 +29,13 @@ As an alternative to compiling [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] progr | |
| |Compile File.vb and create 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`| | ||
| |Compile all [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] files in the current directory, with optimizations on and the `DEBUG` symbol defined, producing File2.exe|`vbc -define:DEBUG=1 -optimize -out:File2.exe *.vb`| | ||
| |Compile all [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] files in the current directory, producing a debug version of File2.dll without displaying the logo or warnings|`vbc -target:library -out:File2.dll -nowarn -nologo -debug *.vb`| | ||
| |Compile all [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] files in the current directory to Something.dll|`vbc -target:library -out:Something.dll *.vb`| | ||
|
|
||
| When compiling from the command line, you must explicitly reference the Microsoft [!INCLUDE[vbprvb](~/includes/vbprvb-md.md)] run-time library through the `-reference` compiler option. | ||
| |Compile File.vb and create both a library and a reference assembly named File.dll|`vbc -target:library -ref:.\debug\bin\ref\file.dll File.vb`| | ||
| |Compile all Visual Basic files in the current directory, with optimizations on and the `DEBUG` symbol defined, producing File2.exe|`vbc -define:DEBUG=1 -optimize -out:File2.exe *.vb`| | ||
| |Compile all Visual Basic files in the current directory, producing a debug version of File2.dll without displaying the logo or warnings|`vbc -target:library -out:File2.dll -nowarn -nologo -debug *.vb`| | ||
| |Compile all Visual Basic files in the current directory to Something.dll|`vbc -target:library -out:Something.dll *.vb`| | ||
|
|
||
| > [!TIP] | ||
| > When you build a project by using the Visual Studio IDE, you can display information about the associated **vbc** command with its compiler options in the output window. To display this information, open the [Options Dialog Box, Projects and Solutions, Build and Run](/visualstudio/ide/reference/options-dialog-box-projects-and-solutions-build-and-run), and then set the **MSBuild project build output verbosity** to **Normal** or a higher level of verbosity. For more information, see [How to: View, Save, and Configure Build Log Files](http://msdn.microsoft.com/library/75d38b76-26d6-4f43-bbe7-cbacd7cc81e7). | ||
| > When you build a project by using the Visual Studio IDE, you can display information about the associated **vbc** command with its compiler options in the output window. To display this information, open the [Options Dialog Box, Projects and Solutions, Build and Run](/visualstudio/ide/reference/options-dialog-box-projects-and-solutions-build-and-run), and then set the **MSBuild project build output verbosity** to **Normal** or a higher level of verbosity. | ||
|
|
||
| ## See Also | ||
| [Visual Basic Command-Line Compiler](../../../visual-basic/reference/command-line-compiler/index.md) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference the compiler-options.md file here.