diff --git a/docs/Binding-and-project-context-evaluation.md b/docs/Binding-and-project-context-evaluation.md index a951d7936b1..0475a7737ab 100644 --- a/docs/Binding-and-project-context-evaluation.md +++ b/docs/Binding-and-project-context-evaluation.md @@ -8,9 +8,11 @@ The feature is available for both `dotnet new` and Visual Studio. ## `bind` symbols The symbol binds value from external sources. + By default, the following sources are available: -- host parameters - parameters defined at certain host. For .NET SDK the following parameters are defined: `HostIdentifier: dotnetcli`, `GlobalJsonExists: true/false`, `WorkingDirectory: `. Binding syntax is `host:`, example: `host:HostIdentifier`. +- host parameters - parameters defined by each individual Template Engine host, for example the .NET CLI, Visual Studio, and C# Dev Kit. See [Host parameters](#host-parameters) for more details. - environment variables - allows to bind environment variables. Binding syntax is `env:`, example: `env:MYENVVAR`. +- msbuild properties - allows to bind to arbitrary MSBuild Properties. Binding syntax is `msbuild:`. See [Binding to MSBuild Properties](#binding-to-msbuild-properties) for more details. It is also possible to bind the parameter without the prefix as a fallback behavior: `HostIdentifier`, `MYENVVAR`. @@ -44,6 +46,31 @@ The higher value indicates higher priority. } } ``` +### Host parameters + +As mentioned above, different hosts may expose different bindable properties for you to use: + +#### .NET CLI + +| Symbol Name | Default value | Meaning | +| - | - | - | +| HostIdentifier | dotnetcli | Uniquely identifies this host | +| WorkingDirectory | System.Environment.CurrentDirectory | The full path that the template engine was invoked from | +| prefs:language | C# | For templates that support multiple programming languages, which one should be chosen if no explicit choice is made | +| dotnet-cli-version | \ | The exact SemVer version of the .NET SDK being run for this invocation of the Template Engine - for example 8.0.404 or 9.0.100-rc.2 | +| RuntimeFrameworkVersion | \ | The exact SemVer version of the Microsoft.NETCore.App Runtime (aka the .NET Runtime) being used by the .NET SDK for this invocation of the Template Engine - for example 8.0.10 or 9.0.0-rc.2.24473.5 | +| NetStandardImplicitPackageVersion | \ | The version of the NetStandard.Library that would be inserted by the .NET SDK - this is deprecated and seems to be mostly wrong, do not use it. | + +#### Visual Studio + +| Symbol Name | Default value | Meaning | +| - | - | - | +| HostIdentifier | dotnetcli | Uniquely identifies this host | +| WorkingDirectory | System.Environment.CurrentDirectory | The full path that the template engine was invoked from | + +#### C# Dev Kit + +TODO: add details about the Dev Kit template engine host ### Binding to MSBuild properties @@ -79,7 +106,6 @@ Example - binds `DefaultNamespace` symbol to `RootNamespace` of the project: } ``` - ## Visual Studio specifics Visual Studio supports binding to host parameters, environment variables and MSBuild properties. @@ -99,4 +125,4 @@ or ```json "type": "bind" "binding": "host:namespace" -``` \ No newline at end of file +```