Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Add Reference Dialog control

Add Reference Dialog control

Scheduled Pinned Locked Moved C#
visual-studiocsharpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jeremy Kimball
    wrote on last edited by
    #1

    (this probably really belongs in the VS IDE board, but I'd rather Mr. Stewart took a read - apologies all) Is there a way to programmatically create the "Add Reference" dialog as seen in the VS.NET IDE? I'm aiming at creating a wizard to generate a particular type of component. During this wizard process, the user will need to select an existing .NET assembly (one that conforms to interface X). I'm wobbling between writing my own file chooser, but if the "Add Reference" dialog is a creatable control, I'd rather use that. Any ideas?


    Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

    L H I 3 Replies Last reply
    0
    • J Jeremy Kimball

      (this probably really belongs in the VS IDE board, but I'd rather Mr. Stewart took a read - apologies all) Is there a way to programmatically create the "Add Reference" dialog as seen in the VS.NET IDE? I'm aiming at creating a wizard to generate a particular type of component. During this wizard process, the user will need to select an existing .NET assembly (one that conforms to interface X). I'm wobbling between writing my own file chooser, but if the "Add Reference" dialog is a creatable control, I'd rather use that. Any ideas?


      Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      Currently, the way the Add Reference works is as follows: Go to the registry Under the Framework it get the list of directories Under each directory it gets each item in the GAC You could probably do something similar where you have either a number of well-known directories or a way of dynamically constructing a directory list. For each assembly in each directory, you would then do an Assembly.Load and check to see if it exposes IMyInterface. ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.

      J 1 Reply Last reply
      0
      • J Jeremy Kimball

        (this probably really belongs in the VS IDE board, but I'd rather Mr. Stewart took a read - apologies all) Is there a way to programmatically create the "Add Reference" dialog as seen in the VS.NET IDE? I'm aiming at creating a wizard to generate a particular type of component. During this wizard process, the user will need to select an existing .NET assembly (one that conforms to interface X). I'm wobbling between writing my own file chooser, but if the "Add Reference" dialog is a creatable control, I'd rather use that. Any ideas?


        Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        As theRealCondor said, you go to the registry. Enumerate the keys under HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders. If you want, you could also have your dialog enumerate the GAC using fusion.dll. Read Undocumented Fusion[^] here on CodeProject for more details. And, no, this really doesn't belong in the IDE forum, since you're only talking about programming something like the IDE has. Just my opinion, anyway.

        Microsoft MVP, Visual C# My Articles

        D 1 Reply Last reply
        0
        • J Jeremy Kimball

          (this probably really belongs in the VS IDE board, but I'd rather Mr. Stewart took a read - apologies all) Is there a way to programmatically create the "Add Reference" dialog as seen in the VS.NET IDE? I'm aiming at creating a wizard to generate a particular type of component. During this wizard process, the user will need to select an existing .NET assembly (one that conforms to interface X). I'm wobbling between writing my own file chooser, but if the "Add Reference" dialog is a creatable control, I'd rather use that. Any ideas?


          Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

          I Offline
          I Offline
          ian mariano
          wrote on last edited by
          #4

          See ExecuteCommand Method (DTE Object). You'll want "Project.AddReference", I think...

          DTE.ExecuteCommand("Project.AddReference", "");
          

          Try it in the immediate window by typing "Project.AddReference" It'll bring up your requested dialog.

          Ian Mariano - Bliki | Blog
          "We are all wave equations in the information matrix of the universe" - me

          J 1 Reply Last reply
          0
          • L LongRange Shooter

            Currently, the way the Add Reference works is as follows: Go to the registry Under the Framework it get the list of directories Under each directory it gets each item in the GAC You could probably do something similar where you have either a number of well-known directories or a way of dynamically constructing a directory list. For each assembly in each directory, you would then do an Assembly.Load and check to see if it exposes IMyInterface. ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.

            J Offline
            J Offline
            Jeremy Kimball
            wrote on last edited by
            #5

            Thanks for the replies guys...I'll probably end up going with the Registry iteration route. Kinda fits what I was thinking before I came up with the Add Reference idea.


            Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

            1 Reply Last reply
            0
            • I ian mariano

              See ExecuteCommand Method (DTE Object). You'll want "Project.AddReference", I think...

              DTE.ExecuteCommand("Project.AddReference", "");
              

              Try it in the immediate window by typing "Project.AddReference" It'll bring up your requested dialog.

              Ian Mariano - Bliki | Blog
              "We are all wave equations in the information matrix of the universe" - me

              J Offline
              J Offline
              Jeremy Kimball
              wrote on last edited by
              #6

              Nifty...never screwed much with the Command Window. Nice to know what it can do. :)


              Jeremy Kimball I have traveled the gutters, lo these many days, with no signs of life. Well met. -brianwelsch

              1 Reply Last reply
              0
              • H Heath Stewart

                As theRealCondor said, you go to the registry. Enumerate the keys under HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders. If you want, you could also have your dialog enumerate the GAC using fusion.dll. Read Undocumented Fusion[^] here on CodeProject for more details. And, no, this really doesn't belong in the IDE forum, since you're only talking about programming something like the IDE has. Just my opinion, anyway.

                Microsoft MVP, Visual C# My Articles

                D Offline
                D Offline
                Dmitri Nesteruk
                wrote on last edited by
                #7

                What exactly is the point of enumerating GAC assemblies? It's not like VS will let you add references to assemblies that are sitting in the GAC.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups