<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 ReplaceParameters="true"
ProjectName="Schema">Source\Schema\Schema.vstemplate</ProjectTemplateLink>
</ProjectCollection>
<CustomParameters>
<CustomParameter Name="$solutionname$"
Value="MCIS.Applications.$safeprojectname$" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
How would I go about passing the $solutionname$ parameter to the Schema
template so the Schema.vbproj file can set the root namespace and assembly
name to MCIS.Applications.<solution name here>.Schema? I'm kinda stuck. In
my Schema.vstemplate file, I can set custom parameters, but I don't know how
to create a custom parameter that has the name of the multi-project solution
as the value of the parameter....the following is my Schema.vstemplate that
does not work:
<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>
<CustomParameters>
<CustomParameter Name="$mcisnamespace$"
Value="$solutionname$.Schema" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
In my Schema.vbproj I have:
<Project .. >
<PropertyGroup>
...
<RootNamespace>$mcisnamespace$</RootNamespace>
...
</PropertyGroup>
...
</Project>
Thanks,
Mythran
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.)
Now we could do like this:
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.
Here is the vstemplate files after change:
Root vstemplate file:
-------------------------------------------------------
<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
-------------------------------------------------------
</TemplateContent>
</VSTemplate>
-------------------------------------------------------
Schema.vbproj
-------------------------------------------------------
<Project .. >
<PropertyGroup>
...
<RootNamespace>$safeprojectname$</RootNamespace>
...
</PropertyGroup>
...
</Project>
-------------------------------------------------------
---------------------
Thank you and have a nice day!
Regards,
Hongye Sun (hon...@online.microsoft.com, remove 'online.')
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
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
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.
You have several projects in the zip file for that template. Each has its
own vstemplate file in addition to the master vstemplate.
1. Write a wizard (class library that implements IWizard). Here's the trick:
ALL VARIABLES THAT YOU WANT TO PASS AMONG PROJECTS MUST BE STATIC:
private static string namespace;
2. Add a form to accept input from the user.
3. Only show the form for the multi-project template:
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.
"Bob Egan" <Bob Eg...@discussions.microsoft.com> wrote in message
news:E0D237ED-83EE-49AA...@microsoft.com...
This 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