I'm trying to create a multi-project template. On the New Project dialog,
they were creating a regular project). My multi-project vstemplate file
name to MCIS.Applications.<solution name here>.Schema? I'm kinda stuck. In
<Project .. >
...
...
...
Hello Mythran,
Welcome to Microsoft Newsgroup Service. My name is Hongye Sun [MSFT]. It is
my pleasure to work with you on this issue.
Do you mean that you want to pass the project name filled by the user when
creating a new project by multiple project template to its sub-project
template as a parameter? So that the sub-project name can contain the user
input project name. Please correct me if I am wrong.
As far as I know, custom parameters will not inherit from root template to
its sub-project templates. However, some default parameters can be passed
to its sub-project templates.
In root template file, we use <ProjectTemplateLink> element to include
sub-project template. Its attribute "ProjectName" will be considered as
default parameters "$projectname$" and "$safeprojectname$" in sub-project
templates. We could also use parameters to specify the "ProjectName"
attribute no matter we set "ReplaceParameters" attribute or not. (Note that
there is no "ReplaceParameters" attribute in <ProjectTemplateLink> element
schema.)
1. Define a custom parameter named "$solutionname$" with value
"MCIS.Applications.$safeprojectname$".
2. Specify the attribute "ProjectName" as "$solutionname$.Schema" in
<ProjectTemlateLink> element.
3. In the Schema.vbproj file, using "$projectname$" or "$safeprojectname$"
to specify its <RootNamespace> element.
-------------------------------------------------------
<VSTemplate Version="2.0.0" Type="ProjectGroup"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>MCIS Web Solution Template</Name>
<Description>MCIS Standard Web Solution Template</Description>
<Icon>__TemplateIcon.ico</Icon>
<ProjectType>VisualBasic</ProjectType>
</TemplateData>
<!-- Template Content -->
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink
ProjectName=""$solutionname$.Schema">Source\Schema\Schema.vstemplate</Projec
tTemplateLink>
</ProjectCollection>
<CustomParameters>
<CustomParameter Name="$solutionname$"
Value="MCIS.Applications.$safeprojectname$" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
-------------------------------------------------------
Schema.vstemplate
-------------------------------------------------------
<VSTemplate Version="2.0.0" Type="Project"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<!-- Template Information -->
<TemplateData>
<Name>Schema</Name>
<Description>MCIS Schema Project Template</Description>
<Icon>__TemplateIcon.ico</Icon>
<ProjectType>VisualBasic</ProjectType>
<CreateNewFolder>true</CreateNewFolder>
<ProvideDefaultName>true</ProvideDefaultName>
<DefaultName>Schema</DefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
</TemplateData>
<!-- Template Contents -->
<TemplateContent>
<Project File="Schema.vbproj" ReplaceParameters="true"
TargetFileName="Source\Schema\Schema.vbproj">
<Folder Name="classes">
<Folder Name="searchcriteria" />
</Folder>
<Folder Name="datasets" />
<Folder Name="My Project">
<ProjectItem
ReplaceParameters="true">Application.myapp</ProjectItem>
<ProjectItem
ReplaceParameters="true">Application.Designer.vb</ProjectItem>
<ProjectItem
ReplaceParameters="true">AssemblyInfo.vb</ProjectItem>
<ProjectItem
ReplaceParameters="true">Settings.settings</ProjectItem>
<ProjectItem
ReplaceParameters="true">Settings.Designer.vb</ProjectItem>
</Folder>
</Project>
</TemplateContent>
</VSTemplate>
-------------------------------------------------------
Schema.vbproj
-------------------------------------------------------
<Project .. >
<PropertyGroup>
...
<RootNamespace>$safeprojectname$</RootNamespace>
...
</PropertyGroup>
...
</Project>
-------------------------------------------------------
Please try the solution above and let me know if you have any question on
it. Thanks.
Regards,
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Hongye Sun [MSFT]Hi Mythran,
Thank you for posting here!
I notice that you have posted the same question in our
microsoft.public.vstudio.extensibility newsgroup, which I have already
responded. So please check my answer there and if you need any further
assistance on this particular issue, please reply to me in that thread so
that I can follow up with you in time.
Please go to
http://www.microsoft.com/communities/newsgroups/en-us/?dg=microsoft.public.v
studio.extensibility&mid=bb27115d-2a8b-4131-bb3e-1c74b3b13688 to view my
reply.
---------------------
Do you mean that you want to pass the project name filled by the user when
creating a new project by multiple project template to its sub-project
template as a parameter? So that the sub-project name can contain the user
input project name. Please correct me if I am wrong.
As far as I know, custom parameters will not inherit from root template to
its sub-project templates. However, some default parameters can be passed
to its sub-project templates.
In root template file, we use <ProjectTemplateLink> element to include
sub-project template. Its attribute "ProjectName" will be considered as
default parameters "$projectname$" and "$safeprojectname$" in sub-project
templates. We could also use parameters to specify the "ProjectName"
attribute no matter we set "ReplaceParameters" attribute or not. (Note that
there is no "ReplaceParameters" attribute in <ProjectTemplateLink> element
schema.)
1. Define a custom parameter named "$solutionname$" with value
"MCIS.Applications.$safeprojectname$".
2. Specify the attribute "ProjectName" as "$solutionname$.Schema" in
<ProjectTemlateLink> element.
3. In the Schema.vbproj file, using "$projectname$" or "$safeprojectname$"
to specify its <RootNamespace> element.
-------------------------------------------------------
<VSTemplate Version="2.0.0" Type="ProjectGroup"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>MCIS Web Solution Template</Name>
<Description>MCIS Standard Web Solution Template</Description>
<Icon>__TemplateIcon.ico</Icon>
<ProjectType>VisualBasic</ProjectType>
</TemplateData>
<!-- Template Content -->
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink
ProjectName=""$solutionname$.Schema">Source\Schema\Schema.vstemplate</Projec
tTemplateLink>
</ProjectCollection>
<CustomParameters>
<CustomParameter Name="$solutionname$"
Value="MCIS.Applications.$safeprojectname$" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
-------------------------------------------------------
Schema.vstemplate
-------------------------------------------------------
<VSTemplate Version="2.0.0" Type="Project"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<!-- Template Information -->
<TemplateData>
<Name>Schema</Name>
<Description>MCIS Schema Project Template</Description>
<Icon>__TemplateIcon.ico</Icon>
<ProjectType>VisualBasic</ProjectType>
<CreateNewFolder>true</CreateNewFolder>
<ProvideDefaultName>true</ProvideDefaultName>
<DefaultName>Schema</DefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
</TemplateData>
<!-- Template Contents -->
<TemplateContent>
<Project File="Schema.vbproj" ReplaceParameters="true"
TargetFileName="Source\Schema\Schema.vbproj">
<Folder Name="classes">
<Folder Name="searchcriteria" />
</Folder>
<Folder Name="datasets" />
<Folder Name="My Project">
<ProjectItem
ReplaceParameters="true">Application.myapp</ProjectItem>
<ProjectItem
ReplaceParameters="true">Application.Designer.vb</ProjectItem>
<ProjectItem
ReplaceParameters="true">AssemblyInfo.vb</ProjectItem>
<ProjectItem
ReplaceParameters="true">Settings.settings</ProjectItem>
<ProjectItem
ReplaceParameters="true">Settings.Designer.vb</ProjectItem>
</Folder>
</Project>
</TemplateContent>
</VSTemplate>
-------------------------------------------------------
Schema.vbproj
-------------------------------------------------------
<Project .. >
<PropertyGroup>
...
<RootNamespace>$safeprojectname$</RootNamespace>
...
</PropertyGroup>
...
</Project>
-------------------------------------------------------
---------------------
Thank you and have a nice day!
Regards,
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
I went ahead and wrote a wizard so now the templates (when using the wizard)
inherit custom parameters (so a multi-project template can set parameters
and the project templates receive these custom parameters as part of their
custom parameters and the project items also see these parameters in their
custom parameter list). The problem I'm confronted with now is changing the
default project location....
When creating a solution from multi-project template, there is no way to
change the solution's name nor specify where the projects from the
multi-project location are to be placed. They have a tendancy to be placed
1 folder deeper than where the solution file is stored and the parent
folder's name is always the name of the solution; so for a multi-project
template when the user enters a Project name of Solution1 the following
C:\SolutionFolder\Solution1.sln
C:\SolutionFolder\Solution1\Project1\Project1.vbproj
C:\SolutionFolder\Solution1\Project2\Project2.vbproj
C:\SolutionFolder\Solution1\Project3\Project3.vbproj
Using only templates if I can, otherwise through the class I wrote that
implements the IWizard interface, I would like to be able to change the
solution's name and the project directories location prior to the projects
C:\SolutionFolder\MCIS.Applications.Solution1.sln
C:\SolutionFolder\Source\Project1\Project1.vbproj
C:\SolutionFolder\Source\Project2\Project2.vbproj
C:\SolutionFolder\Source\Project3\Project3.vbproj
This is the recommended structure for Team Foundation Server projects yet
the default project settings don't really allow you to create the solutions
and projects in this manner. You have to manually move the created solution
project, rename it, move each project folder, and then edit the solution in
a text editor to point to the project files in the new location. This is
kinda strange since the recommended practices from Microsoft defy the
ability of the new solution/project wizards.
Thanks,
Mythran
Post by Hongye Sun [MSFT]Hi Mythran,
As Hongye has been OOF this two days, I'll help him to assist you on this
issue. For the issue, Hongye has been discussing on it with me and I've got
that you've currently got some progress via creating a custom project
wizard which internally call some built-in wizard interface. And there is
one path(which indicate the place VS IDE extract the project template zip
package) parameter you can quite get in your custom wizard, correct?
As for this zip extracting cache location, we have performed some research
and consulted some other engineers, I'm afraid this parameter is somewhat
hidden by the VS IDE and is also undocumented by the product. In order to
make the approach work, so far Hongye and I have thought about one
potential workaround, that is use a custom path for that parameter(instead
of the build-in location the visual studio extract the template zip).
Therefore, we need to extract the template zip file into a custom location
in our own code and supply that location to the wizard interface. How do
you think of this?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
wizard)
the
placed
Post by Bob EganYou have several projects in the zip file for that template. Each has its
own vstemplate file in addition to the master vstemplate.
private static string namespace;
2. Add a form to accept input from the user.
public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object[] customParams)
{
if (runKind == WizardRunKind.AsMultiProject)
{
//show your form and handle the user input
}
}
4. Build the wizard with a strongly named key, and add to your GAC
5. Edit ALL vstemplate files to include the WizardExtension tag pointing to
your wizard.
That's all you need to do.
Hope this helps you.
Post by MythranThis is what I ended up doing. Sorry it took me so long to reply (and the
original message may or may not still be on the server)...there were quite a
few issues with templates in Visual Studio 2008 that I had to use
workarounds for (modifying the sub-directory the projects get placed into
... had to implement IDTWizard and use VSZ files for the projects so I had a
Wizard and template wizard for the projects).
Thanks :)
Mythran