GlobalParams 2.0.0
dotnet add package GlobalParams --version 2.0.0
NuGet\Install-Package GlobalParams -Version 2.0.0
<PackageReference Include="GlobalParams" Version="2.0.0" />
paket add GlobalParams --version 2.0.0
#r "nuget: GlobalParams, 2.0.0"
// Install GlobalParams as a Cake Addin #addin nuget:?package=GlobalParams&version=2.0.0 // Install GlobalParams as a Cake Tool #tool nuget:?package=GlobalParams&version=2.0.0
GlobalParams
What is it?
An assembly that defines an implementation of the IWizard interface which provides all templates in a multi-project template with access to the parameters of the top level template.
You should probably be familiar with the concepts on these links.
To see some existing implementations you can take a look at the source for these projects.
How to use it?
- Ensure that the GlobalParams assembly is deployed to the GAC on any system that will use the template
- Modify all of the .vstemplate files in the multi-project template to include the
WizardExtension
element from this example
<VSTemplate Type="Project" Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<WizardExtension>
<Assembly>GlobalParams, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ea5a5299819fb7c0</Assembly>
<FullClassName>GlobalParams.WizardMPT</FullClassName>
</WizardExtension>
</VSTemplate>
How to use it with custom UI?
Ensure that the GlobalParams assembly is deployed to the GAC on any system that will use the template
Create a project that will define the wizard implementation
Add a reference to the GlobalParams assembly
Create a class and have it derive from
GlobalParams.WizardMPT
Override the
OnBeforeRunStarted
method- Invoke the custom UI component
- Return
true
if the top level template parameters need to be accessible to all templates orfalse
if they do not.
Modify all of the .vstemplate files in the multi-project template to include a
WizardExtension
element that points to your wizard assembly and class.
Documentation
Overridable Methods
Method | Summary |
---|---|
OnBeforeOpeningFile | Invoked when the method BeforeOpeningFile is called by from Visual Studio |
OnProjectFinishedGenerating | Invoked when the method ProjectFinishedGenerating is called by from Visual Studio |
OnProjectItemFinishedGenerating | Invoked when the method ProjectItemFinishedGenerating is called by from Visual Studio |
OnRunFinished | Invoked when the method RunFinished is called by from Visual Studio |
OnShouldAddProjectItem | Invoked when the method ShouldAddProjectItem is called by from Visual Studio |
OnBeforeRunStarted | Invoked when the method RunStarted is called by from Visual Studio and before any modifications are made. If the returned Boolean value is false modifications will NOT be made. |
OnAfterRunStarted | Invoked immediately prior to exiting the RunStarted method. |
Parameter List
IMPORTANT NOTE: Template parameters are case-sensitive.
Project Parameter | Global Parameter | Description |
---|---|---|
clrversion | globalclrversion | Current version of the common language runtime (CLR). |
guid[1-10] | globalguid[1-100] | A Guid used to replace the project GUID in a project file. You can specify up to 100 unique GUIDs (e.g. $globalguid1$, $globalguid83$, etc.) |
itemname | globalitemname | The name provided by the user in the Add New Item dialog box. |
machinename | globalmachinename | The current computer name (for example, Computer01). |
projectname | globalprojectname | The name provided by the user in the New Project dialog box. |
registeredorganization | globalregisteredorganization | The registry key value from HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization. |
rootnamespace | globalrootnamespace | The root namespace of the current project. This parameter is used to replace the namespace only in an item being added to a project. |
safeprojectname | globalsafeprojectname | The name provided by the user in the New Project dialog box, with all unsafe characters and spaces removed. |
time | globaltime | The current time in the format DD/MM/YYYY 00:00:00. |
userdomain | globaluserdomain | The current user domain. |
username | globalusername | The current user name. |
webnamespace | globalwebnamespace | The name of the current Web site. This parameter is used in the Web form template to guarantee unique class names. If the Web site is at the root directory of the Web server, this template parameter resolves to the root directory of the Web Server. |
year | globalyear | The current year in the format YYYY. |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Microsoft.VisualStudio.TemplateWizardInterface (>= 17.0.31902.203)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
2.0.0
Upgraded the project to .Net 4.7.2
1.1.0
Initial Release