locked
VSIX Template: How can I get the template in a sub category in New Project? RRS feed

  • Question

  • Using Visual Studio 2010 without the SDK I have created a VSIX project template package from a vsix wizard I found in the MSDN gallery. For some reason, the SDK would not install on my machine...
    Anyways, I have an VSIX package, it installs perfectly, the only issue I have is that the project template end up under:

    C#
        MyProject

    I want the project to show up in the new peoject dialog under:

    C#
       SharePoint
                       2010
                              MyProject

    I can't seem to get it there. It only ends up in the C# category.
    From what I have read it looks like I have to do one or several of the following:

    -Add a folder structure in the vsix file (tried but did not get it to work)
    -Edit the vsix manifest file (need guidance)
    -Edit the vstemplate file in the project zip.(need guidance)

    If anyone could answer what to change and where, it would make me a happy guy. I have tried it all myself...

    This is what it looks like now:

    Manifest:

    <?xml version="1.0"?>
    <Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
      <Identifier Id="SharePoint Branding Project.afe2458f-a154-40cd-a68b-201ed45970aa">
        <Name>SharePoint Branding Project</Name>
        <Author>Administrator</Author>
        <Version>1.0</Version>
        <Description>This template is used to create a new SharePoint branding solution wsp package, the package includes custom masterpage, stylesheet, logo and favicon. The wsp includes an activation and deactivation feature as well as a childweb eventreciever to apply branding on all subsites when created.</Description>
        <Locale>1033</Locale>
        <GettingStartedGuide>http://blksthl.wordpress.com</GettingStartedGuide>
        <Icon>VSIXProject_small.png</Icon>
        <PreviewImage>VSIXProject_large.png</PreviewImage>
        <InstalledByMsi>false</InstalledByMsi>
        <SupportedProducts>
          <VisualStudio Version="10.0">
            <Edition>Ultimate</Edition>
            <Edition>Premium</Edition>
            <Edition>Pro</Edition>
            <Edition>Express_All</Edition>
          </VisualStudio>
        </SupportedProducts>
        <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
      </Identifier>
      <References />
      <Content>
        <ProjectTemplate>SharePointBrandingProject</ProjectTemplate>
      </Content>
    </Vsix>

    .vstemplate

    <?xml version="1.0"?>
    <VSTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Type="Project" Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
      <TemplateData>
        <Name>SharePoint Branding Project</Name>
        <Description>This template is used to create a new SharePoint branding solution wsp package, the package includes custom masterpage, stylesheet, logo and favicon. The wsp includes an activation and deactivation feature as well as a childweb eventreciever to apply branding on all subsites when created.</Description>
        <Icon>__Template_small.png</Icon>
        <PreviewImage>__Template_large.png</PreviewImage>
        <ProjectType>CSharp</ProjectType>
        <ProjectSubType>SharePoint\SharePoint14</ProjectSubType>
        <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
        <SortOrder>1000</SortOrder>
        <DefaultName>SharePointBrandingProject</DefaultName>
        <ProvideDefaultName>true</ProvideDefaultName>
        <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
        <LocationField>Enabled</LocationField>
      </TemplateData>
    ...and <TemplateContent>...

    Any idea what I need to do?
    Thanks!

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blksthl.wordpress.com


    Wednesday, February 22, 2012 7:25 PM

Answers

  • Ok. Problem solved!
    I don't like this but I have to answer my own question...After downloading about 20 different vsix packages and reverse engineering them, I now know how to solve my issue. (chinesecloudblog11_11, listen up! Hope this works for you as well)

    Here is what I needed to do:
    Like mentioned by Yi I had to create the folder structure inside the vsix file, in my case, to have the project template under Sharepoiunt 2010 it gives:
    \Template\CSharp\SharePoint\SharePoint14\projecttemplate.zip ( I added Template as a container)
    Folder codes:
    CSharp=C#
    SharePoint=SharePoint
    SharePoint14=2010
    Check under: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates" on your Visual Studio 2010 machine to get the correct naming.

    But, this is not enough. 2 more things had to happen.

    In the extension.manifest file located in the root of the vsix file, I had to add the location of the new folder structure, in my case the 'Template' fiolder I use as container for the template and folders:
    <Content>
      <ProjectTemplate>Template</ProjectTemplate>
    </Content>

    But this is not enough either, you also have to tell the template that it and the folders should end up under C#. Not 100% that this is needed but it works for me so...anyways. What I added was where the folder structure should be put, in my case under C#, so that results in the fiollowing in the .vstemplate file:
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType></ProjectSubType>

    Now, package up the file and we are good to go!
    Two more things that can be helpful, add this tag to get the project to show up N steps upwards in the tree:
    <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp> (Mine shows up under 2010 and SharePoint.)

    And, I did all the edits in my packages vsix file. Rename it to .zip and open it up. Extract the project template zip outside of the vsix, make changes, zip it up again and place it back in the vsix structure. (Folders have to be created outside, .zip added to it, then placed in the vsix file, folders in zip cannot be empty)

    I really hope that this helps more people out there!
    (chinesecloudblog11_11, feel free to post a link to your new thread if you don't get it to work)

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blksthl.wordpress.com



    Thursday, February 23, 2012 8:21 AM

All replies

  • same question, can anyone give soultion?

    DL

    Thursday, February 23, 2012 2:23 AM
  • Hi Thomas,

    I think you have know this, Visual Studio use sub folder to manager the categarey for project/item template. VSIX is based on zip file, you you may refer the followings steps:

    1. Rename the vsix file to zip and unzip it to a folder, then you can see all the sturature of the vsix package.

    2. Next you can create the subfolder under projecttemplate folder.

    3. Once you finish, re-zip all files into one zip file and rename it as visx. You can install the vsix as usual.

    Regards,

    Yi


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

    Thursday, February 23, 2012 5:56 AM
  • Hi Yi.

    Thanks for your suggestion.

    I have tried it but it did not work, do I start with CSharp as folder name or the Project name like default?

    Also, it seems like there has to be something more, lika an entry in the manifest or vstemplate file, I simply don't know how to combine the two.
    Good info on the is missing....I have only found partial solutions everywhere.

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blksthl.wordpress.com

    Thursday, February 23, 2012 6:22 AM
  • Ok. Problem solved!
    I don't like this but I have to answer my own question...After downloading about 20 different vsix packages and reverse engineering them, I now know how to solve my issue. (chinesecloudblog11_11, listen up! Hope this works for you as well)

    Here is what I needed to do:
    Like mentioned by Yi I had to create the folder structure inside the vsix file, in my case, to have the project template under Sharepoiunt 2010 it gives:
    \Template\CSharp\SharePoint\SharePoint14\projecttemplate.zip ( I added Template as a container)
    Folder codes:
    CSharp=C#
    SharePoint=SharePoint
    SharePoint14=2010
    Check under: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates" on your Visual Studio 2010 machine to get the correct naming.

    But, this is not enough. 2 more things had to happen.

    In the extension.manifest file located in the root of the vsix file, I had to add the location of the new folder structure, in my case the 'Template' fiolder I use as container for the template and folders:
    <Content>
      <ProjectTemplate>Template</ProjectTemplate>
    </Content>

    But this is not enough either, you also have to tell the template that it and the folders should end up under C#. Not 100% that this is needed but it works for me so...anyways. What I added was where the folder structure should be put, in my case under C#, so that results in the fiollowing in the .vstemplate file:
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType></ProjectSubType>

    Now, package up the file and we are good to go!
    Two more things that can be helpful, add this tag to get the project to show up N steps upwards in the tree:
    <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp> (Mine shows up under 2010 and SharePoint.)

    And, I did all the edits in my packages vsix file. Rename it to .zip and open it up. Extract the project template zip outside of the vsix, make changes, zip it up again and place it back in the vsix structure. (Folders have to be created outside, .zip added to it, then placed in the vsix file, folders in zip cannot be empty)

    I really hope that this helps more people out there!
    (chinesecloudblog11_11, feel free to post a link to your new thread if you don't get it to work)

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blksthl.wordpress.com



    Thursday, February 23, 2012 8:21 AM