0

I have a requirement to generate a custom project template using vsix and IWizard. Wizard will show three check boxes. for example (Bot, Tab , Chat). The output solution must have projects only for checkboxes selected in the wizard i.e if both Bot and Tab are selected then Bot.csproj and Tab.csproj projects will be generated in the solution. If all three of them are selected then all projects must be generated. Right now it generates all the projects irrespective of the selection because there is no way to add conditions in the top most .vsTemplate file. Below is the vsTemplate I have in the code, Is there any way with which I can achieve it?

In short,When we create a asp.net mvc project , if we selected "Tests" checkbox then it will generate a unit test project too. If we doesn't selected it doesn't generate. I have a similar requirement.

<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010">
  <TemplateData>
    <Name>My App (C#)</Name>
    <Description>A project for creating a chat application using C#</Description>
    <Icon>Chat.ico</Icon>
    <ProjectType>CSharp</ProjectType>
    <LanguageTag>csharp</LanguageTag>
    <PlatformTag>C#</PlatformTag>
    <RequiredFrameworkVersion>2.0</RequiredFrameworkVersion>
    <SortOrder>1000</SortOrder>
  </TemplateData>
  <TemplateContent>
    <ProjectCollection>
      <ProjectTemplateLink ProjectName="Tab">
        TabProject\Tab.vstemplate
      </ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="Bot">
        BotProject\Bot.vstemplate
      </ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="Chat">
        ChatProject\Chat.vstemplate
      </ProjectTemplateLink>
    </ProjectCollection>
  </TemplateContent>
</VSTemplate>
Deepak Kothari
  • 1,601
  • 24
  • 31
  • Did you read the [official docs](https://learn.microsoft.com/visualstudio/extensibility/how-to-use-wizards-with-project-templates?view=vs-2019)? – Sir Rufo Feb 14 '20 at 05:15
  • Yes, I started using the above docs and successfully completed the solution creation with three projects in it. Now the challenge is to generate output solution based on the conditions which were not mentioned in the docs. – Deepak Kothari Feb 14 '20 at 05:46
  • https://stackoverflow.com/questions/60294380/is-there-a-way-to-add-conditions-in-vstemplates-or-a-way-to-generate-output-pro , This link has the answer – Deepak Kothari Mar 20 '20 at 03:07
  • https://stackoverflow.com/questions/60294380/is-there-a-way-to-add-conditions-in-vstemplates-or-a-way-to-generate-output-pro , This link has the steps to achieve it. – Deepak Kothari Mar 20 '20 at 03:08

0 Answers0