Re: vbc

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



David Chipping wrote:
> I have run into the following situation, of which I don't understand
> and would appreciate someone filling me in on hopefully an obvious
> detail im looking over:
>
> A compilation example (that compiles) that imports System but does not
> reference System.dll:
>
> vbc /rootnamespace:xxx /target:library
> /r:System.Windows.Forms.dll,System.Drawing.dll /imports:System *.vb
>
> Would this be allowed only if the code never used System, but was
> simply just importing it for no reason at all?
>
> Cheers,
>
> -David

The Import directives (or the import switch your using) are just there
to provide a short-hand. They provide a means for you to provide a
partial class name, and for that to be resolved into a full class name.
E.g., if you have a variable within you project files which is declared
to be of type Drawing.Font, it is the imports which helps the system to
resolve this to System.Drawing.Font.

I believe that the imports are only used by the compiler - I believe
all class names are full class names by the time the Assembly is
output.

Damien

.



Relevant Pages

  • Framework SP2
    ... We applied .Net framework to our dev server and now we get the compilation ... Microsoft Visual Basic .NET Compiler version 7.10.6310.4 ... Line 14: Imports Microsoft.VisualBasic ...
    (microsoft.public.dotnet.framework)
  • RE: Compile Problem: BC31011- Access is denied
    ... An error occurred during the compilation of a resource required ... > dll': Access is denied. ... > Line 14: Imports Microsoft.VisualBasic ... > Line 29: Namespace ASP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Compile Problem: BC31011- Access is denied
    ... An error occurred during the compilation of a resource required ... dll': Access is denied. ... Copyright Microsoft Corporation 1987-2002. ... Line 14: Imports Microsoft.VisualBasic ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: redundant imports
    ... inclusion of modules in c is a purely preprocessing textual matter (compilation is deferred to after the fact), i guess, so that such things are possible. ... That doesn't change the fact that code-1 needs names from code-3, and just because code-3 is imported elsewhere is no reason to think that code-1 magically gets its names too. ...
    (comp.lang.python)
  • Error During compilation
    ... I m using vb.net and framework 1.1 whithout VisualStudio. ... 'My Imports NameSpaces ... Imports Microsoft.VisualBasic 'compilation and code generation for Visual ... Public Shared Sub doExcelExport(ByVal myDataGrid As Control) ...
    (microsoft.public.dotnet.framework.aspnet)