locked
Retrieve the solution name from within a Project and Item Templates RRS feed

  • Question

  • Hi all!

    I'm creating project and item templates for Visual Studio 2008. I need to obtain the name of the solution in which the projects and items are created. Is it possible? I have already written a class the implements the IWizard interface and that is referenced in the vstemplate file via the <WizardExtension> tag; I think I must use the RunStarted method, but how?

    Thank you in advance for the attention.
    Marco Minerva, marco.minerva@gmail.com
    Tuesday, March 16, 2010 9:27 AM

Answers

  • Yes, it is possible. RunStarted method should work.

    Thanks for Reed's suggestion. Just one thing to correct:

    You can directly convert the automationObject argument as DTE object.

    After getting the solution name, you can add it to the replacement directionary.

    Hope it helps.

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    Wednesday, March 17, 2010 9:45 AM

All replies

  • Hi,
    For the solution name, it's pretty easy (you may already have everything...)

    EnvDTE.

    DTE devenv = GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
    Solution soln = devenv.Solution;
    string fullName = soln.FullName;


    There's also handy fields like "FileName" and the projects enumeration.

    HTH,
    Reed Shilts

    • Proposed as answer by Reed Shilts Tuesday, March 16, 2010 4:45 PM
    Tuesday, March 16, 2010 4:45 PM
  • Yes, it is possible. RunStarted method should work.

    Thanks for Reed's suggestion. Just one thing to correct:

    You can directly convert the automationObject argument as DTE object.

    After getting the solution name, you can add it to the replacement directionary.

    Hope it helps.

    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    Wednesday, March 17, 2010 9:45 AM
  • Hi Marco,

    Is this issue resolved? Thanks.

     


    Hongye Sun [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    See what's happening in MSDN forum? Follow us at Twitter.
    Monday, March 29, 2010 9:51 AM
  • Hi!

    Yes, It is. I'm sorry I forgot to click the "Mark As Answer" link :-(

    Thanks again!


    Marco Minerva, marco.minerva@gmail.com
    Monday, March 29, 2010 2:16 PM