locked
How to add references to other assemblies when custom control from toolbox dropped onto WPF design surface RRS feed

  • Question

  • I'm using designer extensibility and AssemblyFoldersEx registry entries to add my custom control to the VS2010 and Expression Blend toolboxes. 

    When dragging my control onto the WPF design surface its assembly is added to the project as a reference, but there is another assembly that my control depends on that also must be added to the project.  How do I do this?

    The only approach I can think of is using DTE in my designer extensibility dll to add the additional assembly reference to the project (the DefaultInitializer InitializeDefaults method).  Is there a better approach?

    Monday, January 16, 2012 7:58 PM

Answers

  • Hi

    We are not sure how the other vendor controls do this.

    Based on my knowledge, add reference using visual studio IDE automation object is highly recommended. We can add reference for project via the references collections from  VSProject Interface.

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by tracktown Monday, February 20, 2012 5:07 PM
    Wednesday, January 18, 2012 3:17 AM

All replies

  • HI Tracktown,

    I agree with you. DTE is correct way for doing some automation for Visual Studio to control the project structure.

    Could you let us know why you have to add "another assembly" for your project when you reference your custom control?

    Regards,

    Yi 

     


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Yi Feng Li Tuesday, January 17, 2012 5:54 AM
    Tuesday, January 17, 2012 5:52 AM
  • Hi Yi,

    Thank you for commenting.

    The other assembly contains interfaces, types, and some factory classes that this control uses.  There are multiple implementations for this control (WPF and WinForms) that requires a reference to this assembly.  This is a very complex control.  Copying or sharing code files to force everything into a single assembly for all the implementations we support is not is not an option.

    I've noticed that other vendor controls, such as Telerik, will add additional references to a project when dropping their control onto a design surface.  How do they do it?  Thanks.

     

     

    Tuesday, January 17, 2012 3:43 PM
  • Hi

    We are not sure how the other vendor controls do this.

    Based on my knowledge, add reference using visual studio IDE automation object is highly recommended. We can add reference for project via the references collections from  VSProject Interface.

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by tracktown Monday, February 20, 2012 5:07 PM
    Wednesday, January 18, 2012 3:17 AM
  • Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 25, 2012 2:10 AM
  • Hi Yi,

    it sounds like IDE automation is the way to go.  I was hoping for someone to chime in and say that the best practice is to implement this in the designer extensibility DLLs.  This must be a common issue.  I'm focused on Visual Studio IDE at the moment, but wil also need to support Expression Blend.

    I'll follow up with what I do.

    Wednesday, January 25, 2012 4:47 PM
  • HI

    Thank you for your update.

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, January 26, 2012 1:49 AM
  • I haven't tried this, but you may want to look at implementing your own ToolboxItem derived object, and add your dependent assemblies to the DependentAssemblies property

    Sincerely,


    Ed Dore
    Thursday, January 26, 2012 6:50 AM