By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

How determine location of Microsoft.Basic.dll?

P: n/a
Hello friends,

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

Thanks,

Alexander

Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Alexander Baranovsky" <ab@cable.netlux.org> schrieb:
How I can determine full path of Microsoft.Basic.dll?


\\\
Imports System.IO
Imports System.Reflection
..
..
..
For Each asm As [Assembly] In AppDomain.CurrentDomain.GetAssemblies()
If Path.GetFileName(asm.Location) = "microsoft.visualbasic.dll" Then
MsgBox(asm.Location)
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/>
Nov 21 '05 #2

P: n/a
Thank you, but this code will return

"microsoft.visualbasic.dll"

not expected something like

"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Micr osoft.VisualBasic.dll"

Alexander

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> ???????/???????? ?
???????? ?????????: news:uK**************@TK2MSFTNGP10.phx.gbl...
"Alexander Baranovsky" <ab@cable.netlux.org> schrieb:
How I can determine full path of Microsoft.Basic.dll?


\\\
Imports System.IO
Imports System.Reflection
.
.
.
For Each asm As [Assembly] In AppDomain.CurrentDomain.GetAssemblies()
If Path.GetFileName(asm.Location) = "microsoft.visualbasic.dll" Then
MsgBox(asm.Location)
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/>

Nov 21 '05 #3

P: n/a
"Alexander Baranovsky" <ab@cable.netlux.org> wrote in message
news:ei*************@TK2MSFTNGP15.phx.gbl...
How I can determine full path of Microsoft.Basic.dll?


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

Regards,
Phill W.
Nov 21 '05 #4

P: n/a
Alexander,
In addition to the other comments:
Short answer: Its in the GAC.
Long answer: Use code similar to:

Dim type As type = GetType(Microsoft.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.VisualBasic.Collection is a type that I know is currently
(.NET 1.0 & 1.1) in the Microsoft.VisualBasic.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.netlux.org> wrote in message
news:ei*************@TK2MSFTNGP15.phx.gbl...
| Hello friends,
|
| How I can determine full path of Microsoft.Basic.dll?
|
| Thanks,
|
| Alexander
|
|
|
Nov 21 '05 #5

P: n/a
Thank you.
Dim type As type = GetType(Microsoft.VisualBasic.Collection)
Debug.WriteLine(type.Assembly.Location)
Alas, this solution does not work for me because I want to dynamically load
the Microsoft.VisualBasic.dll assembly by means of Assembly.LoadFrom 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.VisualBasic.dll in the application).

Alexander

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net>
сообщил/сообщила в новостях следующее:
news:#c**************@tk2msftngp13.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(Microsoft.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.VisualBasic.Collection is a type that I know is currently
(.NET 1.0 & 1.1) in the Microsoft.VisualBasic.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.netlux.org> wrote in message
news:ei*************@TK2MSFTNGP15.phx.gbl...
| Hello friends,
|
| How I can determine full path of Microsoft.Basic.dll?
|
| Thanks,
|
| Alexander
|
|
|

Nov 21 '05 #6

P: n/a
Alexander,
As I stated, Microsoft.VisualBasic.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.LoadWithPartialName:

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

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

Something like:

// C# sample
System.Reflection.Assembly vb =
System.Reflection.Assembly.Load("Microsoft.VisualB asic, Version=7.0.5000.0,
Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a");
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"Alexander Baranovsky" <ab@cable.netlux.org> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
| Thank you.
|
| > Dim type As type = GetType(Microsoft.VisualBasic.Collection)
| > Debug.WriteLine(type.Assembly.Location)
|
| Alas, this solution does not work for me because I want to dynamically
load
| the Microsoft.VisualBasic.dll assembly by means of Assembly.LoadFrom
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.VisualBasic.dll in the
application).
|
| Alexander
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net>
| сообщил/сообщила в новостях следующее:
| news:#c**************@tk2msftngp13.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(Microsoft.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.VisualBasic.Collection is a type that I know is
currently
| > (.NET 1.0 & 1.1) in the Microsoft.VisualBasic.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.netlux.org> wrote in message
| > news:ei*************@TK2MSFTNGP15.phx.gbl...
| > | Hello friends,
| > |
| > | How I can determine full path of Microsoft.Basic.dll?
| > |
| > | Thanks,
| > |
| > | Alexander
| > |
| > |
| > |
| >
| >
|
|
Nov 21 '05 #7

P: n/a
If you really want to use Assembly.LoadFrom, given that the
Microsoft.VisualBasic.dll is in the .NET Framework folder, you can get the
folders of .NET Frameworks using the registry entry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramewor k

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:
http://www.mztools.com

"Alexander Baranovsky" <ab@cable.netlux.org> escribiС en el mensaje
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thank you.
Dim type As type = GetType(Microsoft.VisualBasic.Collection)
Debug.WriteLine(type.Assembly.Location)


Alas, this solution does not work for me because I want to dynamically
load
the Microsoft.VisualBasic.dll assembly by means of Assembly.LoadFrom
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.VisualBasic.dll in the
application).

Alexander

Nov 21 '05 #8

P: n/a
> // C# sample
System.Reflection.Assembly vb =
System.Reflection.Assembly.Load("Microsoft.VisualB asic, Version=7.0.5000.0,
Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a");


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. LoadPartialWithName() 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
CompileAssemblyFromSource, I've only given it file names of references, not
fully qualified names, (through the CompilerParameters.ReferencedAssemblies
member) and yet it still resolves the references sufficiently. I want to be
able to do the same thing.

Brian.
Nov 21 '05 #9

P: n/a
Brian,
Not sure how it does it.

I suspect that the CodeDomProvider is based on LoadWithPartialName, 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\Assembly? 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" <Br**********@discussions.microsoft.com> wrote in message
news:9D**********************************@microsof t.com...
|> // C# sample
| > System.Reflection.Assembly vb =
| > System.Reflection.Assembly.Load("Microsoft.VisualB asic,
Version=7.0.5000.0,
| > Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a");
|
| 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. LoadPartialWithName() 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
| CompileAssemblyFromSource, I've only given it file names of references,
not
| fully qualified names, (through the
CompilerParameters.ReferencedAssemblies
| member) and yet it still resolves the references sufficiently. I want to
be
| able to do the same thing.
|
| Brian.
|
|
Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.