Re: How can I list references in a VB6 project



The references collection is part of the IDE,
the KB article your code refers to refers to MS Access,
the projects in Access are different than VB as they always run in the
Access IDE.
Unlike VB they can always access the reference collection of there IDE.
Projects in VB are different in that they become separated from the IDE when
they are compiled,
for that reason your project has no access to the VB reference collection.

That said, you can access VB's reference collection via an addin.

The Extensibility (Addin) model will run your example code just fine,
as it can access the VB IDE, but for reasons previously stated it will not
be part of your project.

Expected result would be an addin that reporting only on the references
(via a menu in VB, perhaps) of the current project(s) that are loaded in
the IDE.

If you want something that reports at run time about its references,
then your addin could be coded to insert the details into your project with
code
(perhaps a bas mod) so that at run time a self check is done on the target
machine.
That is of course possible but a little more involved
(maybe there is something already out there?) .

"L Mehl" <mehl_nospam@xxxxxxxxxx> wrote in message
news:2OaSe.4163$4P5.727@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello --
>
> Can anyone point me to code or a discussion of how to write code to
> list the references in a project (the results I would get from clicking
> Project > References)?
>
> At a minimum, I want to see
> Name, FileName, FileLocation
> for each reference used in the project.
>
> The following code works for ACCESS but not VB.
>
> Function ReferenceInfo()
> 'MSKB 209849
> Dim strMessage As String
> Dim refItem As Reference '"Reference" is not valid
>
> 10 On Error Resume Next
> 20 For Each refItem In References
> 30 If refItem.IsBroken Then
> 40 strMessage = "Missing Reference:" & vbCrLf &
refItem.FullPath
> 50 Else
> 60 strMessage = _
> "Reference: " & refItem.Name & vbCrLf & _
> " Guid: " & refItem.Guid & vbCrLf & _
> " Location: " & refItem.FullPath & vbCrLf & _
> " BuiltIn: " & refItem.BuiltIn & vbCrLf & _
> " Kind: " & refItem.Kind & vbCrLf & _
> " Major: " & refItem.Major & vbCrLf & _
> " Minor: " & refItem.Minor & vbCrLf
>
> 70 End If
> 80 Debug.Print strMessage
> 90 Next refItem
>
> End Function
>
> Thanks for any help.
>
> Larry Mehl
>
>



.



Relevant Pages

  • Re: Renaming Windows Forms and Files
    ... That is how to change the name of the Form class in the IDE, ... other references to the Form to use the name you change it to. ... rename the Form in your code. ... "Kevin Spencer" wrote: ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Want add / remove Components in ToolBox
    ... (nor does the VS.NET IDE takes its References from there, ... GAC is used mostly at runtime, and has almost no influence on the IDE ... toolbox object model to add / replace your controls on a toolbox tab of your ...
    (microsoft.public.vsnet.ide)
  • Re: Getting the CXML library up and running
    ... include directory of CXML to the project, ... I'm not particularly surprised--the source file specifically references ... Consequently the IDE would have to process the ...
    (comp.lang.fortran)
  • RE: IDE cant find the code changes. (VB.net)
    ... One of our references has incorrect path so IDE stoped building and didn't ... We got the change in IDE. ... >>> By the way,do you work on another source code file whose filename is just ... >>> Gary Chang ...
    (microsoft.public.vsnet.ide)
  • Re: Topic: .NET/COM Interop in VB6 MSProject Addin
    ... Seems like you have the same problem I had when I wrote my MS Project Addin ... Select Debug from configuration settings ... > that references .NET assemblies. ... > directory as the .NET dlls it references. ...
    (microsoft.public.dotnet.framework.interop)