Strange folder hierarchy when creating a multi-project Visual Studio template

I manually create a multi-project template for Visual Studio 2012, and I followed the recommendations on this page: http://msdn.microsoft.com/en-us/library/ms185308.aspx

The problem I am facing is that a fuzzy folder structure is created with this template, which I usually don't expect. The folder structure that I get for a solution called SolutionName:

  [SolutionName]
      |
      \ --- SolutionName.sln
      |
      \ --- [SolutionName]
                |
                \ --- Project1
                |  |
                |  \ --- Project1.csproj
                \ --- Project2
                        |
                        \ --- Project2.csproj

Now what I usually expected would be the following:

  [SolutionName]
      |
      \ --- SolutionName.sln
      |
      \ --- Project1
      |  |
      |  \ --- Project1.csproj
      \ --- Project2
              |
              \ --- Project2.csproj

Is there a way to get the second folder structure?

In addition, when specifying solution folders in the template, they are also created as real folders, is there any way to avoid this?

This is what my multi-project vstemplate file looks like:

<?xml version="1.0"?> <VSTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Type="ProjectGroup" Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"> <TemplateData> <Name>My Multi-Solution Template</Name> <Description>No Description.</Description> <Icon>__TemplateIcon.png</Icon> <PreviewImage>__PreviewImage.png</PreviewImage> <ProjectType>CSharp</ProjectType> <SortOrder>1000</SortOrder> <CreateNewFolder>true</CreateNewFolder> <!-- No use in trying false here. --> <DefaultName>SolutionName</DefaultName> <ProvideDefaultName>true</ProvideDefaultName> <EnableLocationBrowseButton>true</EnableLocationBrowseButton> <LocationField>Enabled</LocationField> </TemplateData> <TemplateContent> <ProjectCollection> <SolutionFolder Name="Application"> <SolutionFolder Name="Tests"> <ProjectTemplateLink ProjectName="$safeprojectname$.UnitTests">UnitTests\UnitTests.vstemplate</ProjectTemplateLink> </SolutionFolder> <ProjectTemplateLink ProjectName="$safeprojectname$.Core">Core\Core.vstemplate</ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Infrastructure">Infrastructure\Infrastructure.vstemplate</ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.Model">Model\Model.vstemplate</ProjectTemplateLink> </SolutionFolder> <SolutionFolder Name="Service"> <ProjectTemplateLink ProjectName="$safeprojectname$.ServiceHost">ServiceHost\ServiceHost.vstemplate</ProjectTemplateLink> <ProjectTemplateLink ProjectName="$safeprojectname$.ServiceLibrary">ServiceLibrary\ServiceLibrary.vstemplate</ProjectTemplateLink> </SolutionFolder> </ProjectCollection> <CustomParameters /> </TemplateContent> </VSTemplate> 

Thanks!

+9
source share
2 answers

I have the same problem. I found this similar question with a suggestion to use nested templates and a wizard, just about to try ...

0
source

Check here for more information on this topic. Perhaps at some point the team is documenting this.

You can also install Amusoft tools from the VS Marketplace to move folders. This will update the solution and links to other projects.

0
source

Source: https://habr.com/ru/post/948216/


All Articles