Skip to content

Commit 40f6e5b

Browse files
Update framework symbol on dotnet new template #1512 (#1630)
* update template framework variable to be passed from option with default 5.0 * refine the framework parameters. * remove duplicate infomation.
1 parent d179261 commit 40f6e5b

File tree

6 files changed

+132
-21
lines changed

6 files changed

+132
-21
lines changed

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,49 @@
3232
"frameworks": {
3333
"type": "parameter",
3434
"datatype": "string",
35-
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472).",
36-
"defaultValue": "netstandard2.0",
35+
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true",
36+
"defaultValue": ""
37+
},
38+
"frameworksDefaults": {
39+
"type": "generated",
40+
"generator": "switch",
41+
"description": "generate a default framework value based on consoleApp",
42+
"parameters": {
43+
"evaluator": "C++",
44+
"datatype": "string",
45+
"cases": [
46+
{
47+
"condition": "(frameworks == '' && consoleApp == true)",
48+
"value": "net5.0"
49+
},
50+
{
51+
"condition": "(frameworks == '' && consoleApp == false)",
52+
"value": "netstandard2.0"
53+
},
54+
{
55+
"condition": "(frameworks != '')",
56+
"value": ""
57+
}
58+
]
59+
},
60+
"replaces": "$(Frameworks)"
61+
},
62+
"frameworksValue": {
63+
"type": "generated",
64+
"generator": "join",
65+
"description": "join frameworks and frameworksDefaults",
66+
"parameters": {
67+
"symbols": [
68+
{
69+
"type": "ref",
70+
"value": "frameworks"
71+
},
72+
{
73+
"type": "ref",
74+
"value": "frameworksDefaults"
75+
}
76+
]
77+
},
3778
"replaces": "$(Frameworks)"
3879
},
3980
"config": {

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3-
<TargetFramework>netcoreapp3.0</TargetFramework>
4-
<OutputType>Exe</OutputType>
5-
</PropertyGroup>
6-
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
2+
<PropertyGroup>
73
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
84
</PropertyGroup>
95
<PropertyGroup>

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,49 @@
3232
"frameworks": {
3333
"type": "parameter",
3434
"datatype": "string",
35-
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472).",
36-
"defaultValue": "netstandard2.0",
35+
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true",
36+
"defaultValue": ""
37+
},
38+
"frameworksDefaults": {
39+
"type": "generated",
40+
"generator": "switch",
41+
"description": "generate a default framework value based on consoleApp",
42+
"parameters": {
43+
"evaluator": "C++",
44+
"datatype": "string",
45+
"cases": [
46+
{
47+
"condition": "(frameworks == '' && consoleApp == true)",
48+
"value": "net5.0"
49+
},
50+
{
51+
"condition": "(frameworks == '' && consoleApp == false)",
52+
"value": "netstandard2.0"
53+
},
54+
{
55+
"condition": "(frameworks != '')",
56+
"value": ""
57+
}
58+
]
59+
},
60+
"replaces": "$(Frameworks)"
61+
},
62+
"frameworksValue": {
63+
"type": "generated",
64+
"generator": "join",
65+
"description": "join frameworks and frameworksDefaults",
66+
"parameters": {
67+
"symbols": [
68+
{
69+
"type": "ref",
70+
"value": "frameworks"
71+
},
72+
{
73+
"type": "ref",
74+
"value": "frameworksDefaults"
75+
}
76+
]
77+
},
3778
"replaces": "$(Frameworks)"
3879
},
3980
"config": {

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3-
<TargetFramework>netcoreapp3.0</TargetFramework>
4-
<OutputType>Exe</OutputType>
5-
</PropertyGroup>
6-
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
2+
<PropertyGroup>
73
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
84
</PropertyGroup>
95
<PropertyGroup>

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,49 @@
3232
"frameworks": {
3333
"type": "parameter",
3434
"datatype": "string",
35-
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472).",
36-
"defaultValue": "netstandard2.0",
35+
"description": "The target framework(s) for the project (e.g. netstandard2.0;net472). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is true",
36+
"defaultValue": ""
37+
},
38+
"frameworksDefaults": {
39+
"type": "generated",
40+
"generator": "switch",
41+
"description": "generate a default framework value based on consoleApp",
42+
"parameters": {
43+
"evaluator": "C++",
44+
"datatype": "string",
45+
"cases": [
46+
{
47+
"condition": "(frameworks == '' && consoleApp == true)",
48+
"value": "net5.0"
49+
},
50+
{
51+
"condition": "(frameworks == '' && consoleApp == false)",
52+
"value": "netstandard2.0"
53+
},
54+
{
55+
"condition": "(frameworks != '')",
56+
"value": ""
57+
}
58+
]
59+
},
60+
"replaces": "$(Frameworks)"
61+
},
62+
"frameworksValue": {
63+
"type": "generated",
64+
"generator": "join",
65+
"description": "join frameworks and frameworksDefaults",
66+
"parameters": {
67+
"symbols": [
68+
{
69+
"type": "ref",
70+
"value": "frameworks"
71+
},
72+
{
73+
"type": "ref",
74+
"value": "frameworksDefaults"
75+
}
76+
]
77+
},
3778
"replaces": "$(Frameworks)"
3879
},
3980
"config": {

templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3-
<TargetFramework>netcoreapp3.0</TargetFramework>
4-
<OutputType>Exe</OutputType>
5-
</PropertyGroup>
6-
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
2+
<PropertyGroup>
73
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
84
</PropertyGroup>
95
<PropertyGroup>

0 commit comments

Comments
 (0)