Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard implementation via VSIX to deploy template.json #28

Open
namtar1447 opened this issue Jan 22, 2018 · 4 comments
Open

Wizard implementation via VSIX to deploy template.json #28

namtar1447 opened this issue Jan 22, 2018 · 4 comments

Comments

@namtar1447
Copy link

Hello,

Not sure how to go about sharing my question, feel free to enlighten me on how best to get the answer I need.

I've been working on a multi-project template.json and fine-tuning/testing using the dotnet new CLI. I now want to allow other developers to benefit from this and started wrapping it in a VSIX starting from the Template Pack Project Template. Deployment of the template works fine in the experimental instance.

Now, my template.json references a dozen or so symbols I would need to define when creating the project, so I started looking into doing an IWizard, discovered the joys of Windows Forms along the way, and now I've got all my parameters in memory ready to be used ... but can't find how to take those parameters and pass them to VS to do the equivalent of passing them as CLI parameters of 'dotnet new'.

Are there any alternatives to a Wizard to do what I need? Is this even the right place to post?

Thanks a ton for your help.

@sayedihashimi
Copy link
Member

Hi @namtar1447, since you are wanting to show a UI or collect info from the user in Visual Studio, you'll need to create a custom wizard. You can do this with Win Forms or WPF.

@namtar1447
Copy link
Author

Thank you for the answer. Yes, the Wizard works, basically I just am unable to pass in the symbols. Here's an example:

"symbols": {
    "shortServiceName": {
      "isRequired": true,
      "type": "parameter",
      "datatype": "text",
      "description": "Short service name with no punctuation or spaces to be used in class names i.e. EnpCatalogImporter",
      "replaces": "ShortServiceName",
      "fileRename": "ShortServiceName"
    }
}

I would typically just use the command-line parameters when calling dotnet new, but I can't find an equivalent way to do this when the wizard is invoked this way.

<WizardExtension>
    <Assembly>MpcExtensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=82b0b51e56c4f5a1</Assembly>
    <FullClassName>MpcExtensions.SolutionTemplates.MpcWindowsServiceWizard</FullClassName>
  </WizardExtension>
  <WizardExtension>
    <Assembly>Microsoft.VisualStudio.TemplateEngine.Wizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
    <FullClassName>Microsoft.VisualStudio.TemplateEngine.Wizard.TemplateEngineWizard</FullClassName>
  </WizardExtension>

Am I supposed to be able to use CustomerParameters in a specific way to do so?

@sayedihashimi
Copy link
Member

There is a special syntax to indicate that the parameter should be passed through, take a look at my sample. Specifically this line.

@codewithtyler
Copy link
Member

@namtar1447 Did the solution above solve your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants