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. .NET (Core and Framework)
  4. Appending the ToolboxItem.DependentAssemblies property

Appending the ToolboxItem.DependentAssemblies property

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdotnetvisual-studiotutorialannouncement
2 Posts 2 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.
  • A Offline
    A Offline
    astibich2
    wrote on last edited by
    #1

    I am writing a Visual Studio 2008 Tool Window plugin that exposes a custom toolbox. I create controls on Forms using the 'ToolboxItem' class. I would like to append to the ToolboxItem dependencies, such that my assembly will be auto-inserted as a reference after the control creation. Here's an example of what I'm trying to do: ToolboxItem tbi = new ToolboxItem(typeof(CheckBox)); AssemblyName[] depends = tbi.DependentAssemblies; List listDepends = new List(); listDepends.AddRange(depends); listDepends.Add(new AssemblyName("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7d025b3483b4afc")); tbi.DependentAssemblies = listDepends.ToArray(); The control gets created fine, but 'MyAssembly' is not added to the project references. 'MyAssembly' is installed in the GAC - I've double checked that the full path is correct. Thanks, Aaron

    0 1 Reply Last reply
    0
    • A astibich2

      I am writing a Visual Studio 2008 Tool Window plugin that exposes a custom toolbox. I create controls on Forms using the 'ToolboxItem' class. I would like to append to the ToolboxItem dependencies, such that my assembly will be auto-inserted as a reference after the control creation. Here's an example of what I'm trying to do: ToolboxItem tbi = new ToolboxItem(typeof(CheckBox)); AssemblyName[] depends = tbi.DependentAssemblies; List listDepends = new List(); listDepends.AddRange(depends); listDepends.Add(new AssemblyName("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7d025b3483b4afc")); tbi.DependentAssemblies = listDepends.ToArray(); The control gets created fine, but 'MyAssembly' is not added to the project references. 'MyAssembly' is installed in the GAC - I've double checked that the full path is correct. Thanks, Aaron

      0 Offline
      0 Offline
      0x3c0
      wrote on last edited by
      #2

      AFAIK, this isn't possible. Imagine what would happen if a malicious application injected itself as a dependency into the Form class. Load Form class = load malicious application into memory = bad in one way or another The best thing you could do would be making a derived class, and add your assembly as a reference

      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