GlobalParams 2.0.0

dotnet add package GlobalParams --version 2.0.0                
NuGet\Install-Package GlobalParams -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GlobalParams" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GlobalParams --version 2.0.0                
#r "nuget: GlobalParams, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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.

How to use it?

  1. Ensure that the GlobalParams assembly is deployed to the GAC on any system that will use the template
  2. 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?

  1. Ensure that the GlobalParams assembly is deployed to the GAC on any system that will use the template

  2. Create a project that will define the wizard implementation

  3. Add a reference to the GlobalParams assembly

  4. Create a class and have it derive from GlobalParams.WizardMPT

  5. Override the OnBeforeRunStarted method

    1. Invoke the custom UI component
    2. Return true if the top level template parameters need to be accessible to all templates or false if they do not.
  6. 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 Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 484 2/8/2022
1.1.0 2,812 2/17/2019

2.0.0
Upgraded the project to .Net 4.7.2

1.1.0
Initial Release