How determine location of Microsoft.Basic.dll?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Baranovsky

    #1

    How determine location of Microsoft.Basic.dll?

    Hello friends,

    How I can determine full path of Microsoft.Basic .dll?

    Thanks,

    Alexander



  • Herfried K. Wagner [MVP]

    #2
    Re: How determine location of Microsoft.Basic .dll?

    "Alexander Baranovsky" <ab@cable.netlu x.org> schrieb:[color=blue]
    > How I can determine full path of Microsoft.Basic .dll?[/color]

    \\\
    Imports System.IO
    Imports System.Reflecti on
    ..
    ..
    ..
    For Each asm As [Assembly] In AppDomain.Curre ntDomain.GetAss emblies()
    If Path.GetFileNam e(asm.Location) = "microsoft.visu albasic.dll" Then
    MsgBox(asm.Loca tion)
    Exit For
    End If
    Next asm
    ///

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Alexander Baranovsky

      #3
      Re: How determine location of Microsoft.Basic .dll?

      Thank you, but this code will return

      "microsoft.visu albasic.dll"

      not expected something like

      "C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \Microsoft.Visu alBasic.dll"

      Alexander

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> ???????/???????? ?
      ???????? ?????????: news:uKmLOgw0FH A.2888@TK2MSFTN GP10.phx.gbl...[color=blue]
      > "Alexander Baranovsky" <ab@cable.netlu x.org> schrieb:[color=green]
      > > How I can determine full path of Microsoft.Basic .dll?[/color]
      >
      > \\\
      > Imports System.IO
      > Imports System.Reflecti on
      > .
      > .
      > .
      > For Each asm As [Assembly] In AppDomain.Curre ntDomain.GetAss emblies()
      > If Path.GetFileNam e(asm.Location) = "microsoft.visu albasic.dll" Then
      > MsgBox(asm.Loca tion)
      > Exit For
      > End If
      > Next asm
      > ///
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>[/color]


      Comment

      • Phill.  W

        #4
        Re: How determine location of Microsoft.Basic .dll?

        "Alexander Baranovsky" <ab@cable.netlu x.org> wrote in message
        news:eid4KSv0FH A.460@TK2MSFTNG P15.phx.gbl...
        [color=blue]
        > How I can determine full path of Microsoft.Basic .dll?[/color]

        Given that it ships as part of the .Net Framework, why do you feel
        the need to?

        Regards,
        Phill W.


        Comment

        • Jay B. Harlow [MVP - Outlook]

          #5
          Re: How determine location of Microsoft.Basic .dll?

          Alexander,
          In addition to the other comments:


          Short answer: Its in the GAC.


          Long answer: Use code similar to:

          Dim type As type = GetType(Microso ft.VisualBasic. Collection)
          Debug.WriteLine (type.Assembly. Location)

          However be aware its in the GAC & you really shouldn't rely on the disk
          location as the GAC can keep multiple versions of the same assembly.

          NOTE: Microsoft.Visua lBasic.Collecti on is a type that I know is currently
          (.NET 1.0 & 1.1) in the Microsoft.Visua lBasic.dll, the above only works for
          types that you know are in the specific assembly...

          --
          Hope this helps
          Jay [MVP - Outlook]
          T.S. Bradley - http://www.tsbradley.net


          "Alexander Baranovsky" <ab@cable.netlu x.org> wrote in message
          news:eid4KSv0FH A.460@TK2MSFTNG P15.phx.gbl...
          | Hello friends,
          |
          | How I can determine full path of Microsoft.Basic .dll?
          |
          | Thanks,
          |
          | Alexander
          |
          |
          |


          Comment

          • Alexander Baranovsky

            #6
            Re: How determine location of Microsoft.Basic .dll?

            Thank you.
            [color=blue]
            > Dim type As type = GetType(Microso ft.VisualBasic. Collection)
            > Debug.WriteLine (type.Assembly. Location)[/color]

            Alas, this solution does not work for me because I want to dynamically load
            the Microsoft.Visua lBasic.dll assembly by means of Assembly.LoadFr om method
            at run-time. (I'm creating a VB.NET interpreter in C# and I would not like
            to use a static reference on Microsoft.Visua lBasic.dll in the application).

            Alexander

            "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @tsbradley.net>
            ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
            news:#cBC1Jz0FH A.2792@tk2msftn gp13.phx.gbl...[color=blue]
            > Alexander,
            > In addition to the other comments:
            >
            >
            > Short answer: Its in the GAC.
            >
            >
            > Long answer: Use code similar to:
            >
            > Dim type As type = GetType(Microso ft.VisualBasic. Collection)
            > Debug.WriteLine (type.Assembly. Location)
            >
            > However be aware its in the GAC & you really shouldn't rely on the disk
            > location as the GAC can keep multiple versions of the same assembly.
            >
            > NOTE: Microsoft.Visua lBasic.Collecti on is a type that I know is currently
            > (.NET 1.0 & 1.1) in the Microsoft.Visua lBasic.dll, the above only works[/color]
            for[color=blue]
            > types that you know are in the specific assembly...
            >
            > --
            > Hope this helps
            > Jay [MVP - Outlook]
            > T.S. Bradley - http://www.tsbradley.net
            >
            >
            > "Alexander Baranovsky" <ab@cable.netlu x.org> wrote in message
            > news:eid4KSv0FH A.460@TK2MSFTNG P15.phx.gbl...
            > | Hello friends,
            > |
            > | How I can determine full path of Microsoft.Basic .dll?
            > |
            > | Thanks,
            > |
            > | Alexander
            > |
            > |
            > |
            >
            >[/color]


            Comment

            • Jay B. Harlow [MVP - Outlook]

              #7
              Re: How determine location of Microsoft.Basic .dll?

              Alexander,
              As I stated, Microsoft.Visua lBasic.dll is in the GAC, you don't need to know
              where it is on the disk!

              To dynamically load it simply use Assembly.Load or
              Assembly.LoadWi thPartialName:

              http://msdn.microsoft.com/library/de...sLoadTopic.asp

              http://msdn.microsoft.com/library/de...lNameTopic.asp

              Something like:

              // C# sample
              System.Reflecti on.Assembly vb =
              System.Reflecti on.Assembly.Loa d("Microsoft.Vi sualBasic, Version=7.0.500 0.0,
              Culture=Neutral , PublicKeyToken= b03f5f7f11d50a3 a");


              --
              Hope this helps
              Jay [MVP - Outlook]
              T.S. Bradley - http://www.tsbradley.net


              "Alexander Baranovsky" <ab@cable.netlu x.org> wrote in message
              news:%238oq6m10 FHA.3256@TK2MSF TNGP09.phx.gbl. ..
              | Thank you.
              |
              | > Dim type As type = GetType(Microso ft.VisualBasic. Collection)
              | > Debug.WriteLine (type.Assembly. Location)
              |
              | Alas, this solution does not work for me because I want to dynamically
              load
              | the Microsoft.Visua lBasic.dll assembly by means of Assembly.LoadFr om
              method
              | at run-time. (I'm creating a VB.NET interpreter in C# and I would not like
              | to use a static reference on Microsoft.Visua lBasic.dll in the
              application).
              |
              | Alexander
              |
              | "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @tsbradley.net>
              | ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
              | news:#cBC1Jz0FH A.2792@tk2msftn gp13.phx.gbl...
              | > Alexander,
              | > In addition to the other comments:
              | >
              | >
              | > Short answer: Its in the GAC.
              | >
              | >
              | > Long answer: Use code similar to:
              | >
              | > Dim type As type = GetType(Microso ft.VisualBasic. Collection)
              | > Debug.WriteLine (type.Assembly. Location)
              | >
              | > However be aware its in the GAC & you really shouldn't rely on the disk
              | > location as the GAC can keep multiple versions of the same assembly.
              | >
              | > NOTE: Microsoft.Visua lBasic.Collecti on is a type that I know is
              currently
              | > (.NET 1.0 & 1.1) in the Microsoft.Visua lBasic.dll, the above only works
              | for
              | > types that you know are in the specific assembly...
              | >
              | > --
              | > Hope this helps
              | > Jay [MVP - Outlook]
              | > T.S. Bradley - http://www.tsbradley.net
              | >
              | >
              | > "Alexander Baranovsky" <ab@cable.netlu x.org> wrote in message
              | > news:eid4KSv0FH A.460@TK2MSFTNG P15.phx.gbl...
              | > | Hello friends,
              | > |
              | > | How I can determine full path of Microsoft.Basic .dll?
              | > |
              | > | Thanks,
              | > |
              | > | Alexander
              | > |
              | > |
              | > |
              | >
              | >
              |
              |


              Comment

              • Carlos J. Quintero [VB MVP]

                #8
                Re: How determine location of Microsoft.Basic .dll?

                If you really want to use Assembly.LoadFr om, given that the
                Microsoft.Visua lBasic.dll is in the .NET Framework folder, you can get the
                folders of .NET Frameworks using the registry entry:

                HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\.NETFra mework

                But I would use Jay's approach, using Assembly.Load and the full qualified
                assembly name.

                --

                Best regards,

                Carlos J. Quintero

                MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
                You can code, design and document much faster.
                Free resources for add-in developers:
                MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


                "Alexander Baranovsky" <ab@cable.netlu x.org> escribió en el mensaje
                news:%238oq6m10 FHA.3256@TK2MSF TNGP09.phx.gbl. ..[color=blue]
                > Thank you.
                >[color=green]
                >> Dim type As type = GetType(Microso ft.VisualBasic. Collection)
                >> Debug.WriteLine (type.Assembly. Location)[/color]
                >
                > Alas, this solution does not work for me because I want to dynamically
                > load
                > the Microsoft.Visua lBasic.dll assembly by means of Assembly.LoadFr om
                > method
                > at run-time. (I'm creating a VB.NET interpreter in C# and I would not like
                > to use a static reference on Microsoft.Visua lBasic.dll in the
                > application).
                >
                > Alexander[/color]


                Comment

                • Brian C. Barnes

                  #9
                  Re: How determine location of Microsoft.Basic .dll?

                  > // C# sample[color=blue]
                  > System.Reflecti on.Assembly vb =
                  > System.Reflecti on.Assembly.Loa d("Microsoft.Vi sualBasic, Version=7.0.500 0.0,
                  > Culture=Neutral , PublicKeyToken= b03f5f7f11d50a3 a");[/color]

                  I'm in a similar situation, where I want to be able to load an assembly
                  given just the file name of the .dll file. LoadPartialWith Name() currently
                  works for what I need, but it is marked obsolete. Is there an alternative
                  that will work with just a file name.

                  Note: The CodeDomProvider has this functionality, because when I call
                  CompileAssembly FromSource, I've only given it file names of references, not
                  fully qualified names, (through the CompilerParamet ers.ReferencedA ssemblies
                  member) and yet it still resolves the references sufficiently. I want to be
                  able to do the same thing.

                  Brian.


                  Comment

                  • Jay B. Harlow [MVP - Outlook]

                    #10
                    Re: How determine location of Microsoft.Basic .dll?

                    Brian,
                    Not sure how it does it.

                    I suspect that the CodeDomProvider is based on LoadWithPartial Name, or more
                    then likely they are both based on some, possibly internal, API.

                    Then again what is Reflector using to display assemblies in its "Assembly
                    Cache" dialog? Is it looking directly into \Windows\Assemb ly? or is there
                    some obscure Framework object that provides a list of the Assemblies in the
                    GAC?

                    --
                    Hope this helps
                    Jay [MVP - Outlook]
                    ..NET Application Architect, Enthusiast, & Evangelist
                    T.S. Bradley - http://www.tsbradley.net


                    "Brian C. Barnes" <BrianCBarnes@d iscussions.micr osoft.com> wrote in message
                    news:9DC2FA6E-5E47-4EB9-903B-5538B8E65140@mi crosoft.com...
                    |> // C# sample
                    | > System.Reflecti on.Assembly vb =
                    | > System.Reflecti on.Assembly.Loa d("Microsoft.Vi sualBasic,
                    Version=7.0.500 0.0,
                    | > Culture=Neutral , PublicKeyToken= b03f5f7f11d50a3 a");
                    |
                    | I'm in a similar situation, where I want to be able to load an assembly
                    | given just the file name of the .dll file. LoadPartialWith Name() currently
                    | works for what I need, but it is marked obsolete. Is there an alternative
                    | that will work with just a file name.
                    |
                    | Note: The CodeDomProvider has this functionality, because when I call
                    | CompileAssembly FromSource, I've only given it file names of references,
                    not
                    | fully qualified names, (through the
                    CompilerParamet ers.ReferencedA ssemblies
                    | member) and yet it still resolves the references sufficiently. I want to
                    be
                    | able to do the same thing.
                    |
                    | Brian.
                    |
                    |


                    Comment

                    Working...