Skip to content

Commit d71a7e3

Browse files
update console app templating (#1632)
* update console app templating * make single targetframework for both console app and classlib.
1 parent 5d421c2 commit d71a7e3

File tree

6 files changed

+57
-48
lines changed

6 files changed

+57
-48
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"FileRename": "_BenchmarkName_",
3030
"replaces": "$(BenchmarkName)"
3131
},
32-
"frameworks": {
32+
"framework": {
3333
"type": "parameter",
3434
"datatype": "string",
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",
35+
"description": "The target framework for the project (e.g. netstandard2.0). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is false",
3636
"defaultValue": ""
3737
},
38-
"frameworksDefaults": {
38+
"frameworkDefault": {
3939
"type": "generated",
4040
"generator": "switch",
4141
"description": "generate a default framework value based on consoleApp",
@@ -44,38 +44,37 @@
4444
"datatype": "string",
4545
"cases": [
4646
{
47-
"condition": "(frameworks == '' && consoleApp == true)",
47+
"condition": "(framework == '' && consoleApp == true)",
4848
"value": "net5.0"
4949
},
5050
{
51-
"condition": "(frameworks == '' && consoleApp == false)",
51+
"condition": "(framework == '' && consoleApp == false)",
5252
"value": "netstandard2.0"
5353
},
5454
{
55-
"condition": "(frameworks != '')",
55+
"condition": "(framework != '')",
5656
"value": ""
5757
}
5858
]
59-
},
60-
"replaces": "$(Frameworks)"
59+
}
6160
},
62-
"frameworksValue": {
61+
"frameworkValue": {
6362
"type": "generated",
6463
"generator": "join",
65-
"description": "join frameworks and frameworksDefaults",
64+
"description": "join framework and frameworkDefault",
6665
"parameters": {
6766
"symbols": [
6867
{
6968
"type": "ref",
70-
"value": "frameworks"
69+
"value": "framework"
7170
},
7271
{
7372
"type": "ref",
74-
"value": "frameworksDefaults"
73+
"value": "frameworkDefault"
7574
}
7675
]
7776
},
78-
"replaces": "$(Frameworks)"
77+
"replaces": "$(Framework)"
7978
},
8079
"config": {
8180
"type": "parameter",
@@ -99,7 +98,7 @@
9998
"type": "parameter",
10099
"datatype": "string",
101100
"description": "Version of BenchmarkDotNet that will be referenced.",
102-
"defaultValue": "0.12.0",
101+
"defaultValue": "0.12.1",
103102
"replaces": "$(BenchmarkDotNetVersion)"
104103
}
105104
},

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
2+
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3+
<TargetFramework>$(Framework)</TargetFramework>
4+
<OutputType>Exe</OutputType>
45
</PropertyGroup>
6+
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
7+
<TargetFramework>$(Framework)</TargetFramework>
8+
</PropertyGroup>
59
<PropertyGroup>
610
<PlatformTarget>AnyCPU</PlatformTarget>
711
<DebugType>portable</DebugType>

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"FileRename": "_BenchmarkName_",
3030
"replaces": "$(BenchmarkName)"
3131
},
32-
"frameworks": {
32+
"framework": {
3333
"type": "parameter",
3434
"datatype": "string",
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",
35+
"description": "The target framework for the project (e.g. netstandard2.0). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is false",
3636
"defaultValue": ""
3737
},
38-
"frameworksDefaults": {
38+
"frameworkDefault": {
3939
"type": "generated",
4040
"generator": "switch",
4141
"description": "generate a default framework value based on consoleApp",
@@ -44,38 +44,37 @@
4444
"datatype": "string",
4545
"cases": [
4646
{
47-
"condition": "(frameworks == '' && consoleApp == true)",
47+
"condition": "(framework == '' && consoleApp == true)",
4848
"value": "net5.0"
4949
},
5050
{
51-
"condition": "(frameworks == '' && consoleApp == false)",
51+
"condition": "(framework == '' && consoleApp == false)",
5252
"value": "netstandard2.0"
5353
},
5454
{
55-
"condition": "(frameworks != '')",
55+
"condition": "(framework != '')",
5656
"value": ""
5757
}
5858
]
59-
},
60-
"replaces": "$(Frameworks)"
59+
}
6160
},
62-
"frameworksValue": {
61+
"frameworkValue": {
6362
"type": "generated",
6463
"generator": "join",
65-
"description": "join frameworks and frameworksDefaults",
64+
"description": "join framework and frameworkDefault",
6665
"parameters": {
6766
"symbols": [
6867
{
6968
"type": "ref",
70-
"value": "frameworks"
69+
"value": "framework"
7170
},
7271
{
7372
"type": "ref",
74-
"value": "frameworksDefaults"
73+
"value": "frameworkDefault"
7574
}
7675
]
7776
},
78-
"replaces": "$(Frameworks)"
77+
"replaces": "$(Framework)"
7978
},
8079
"config": {
8180
"type": "parameter",
@@ -99,7 +98,7 @@
9998
"type": "parameter",
10099
"datatype": "string",
101100
"description": "Version of BenchmarkDotNet that will be referenced.",
102-
"defaultValue": "0.12.0",
101+
"defaultValue": "0.12.1",
103102
"replaces": "$(BenchmarkDotNetVersion)"
104103
}
105104
},

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
2+
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3+
<TargetFramework>$(Framework)</TargetFramework>
4+
<OutputType>Exe</OutputType>
5+
</PropertyGroup>
6+
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
7+
<TargetFramework>$(Framework)</TargetFramework>
48
</PropertyGroup>
59
<PropertyGroup>
610
<PlatformTarget>AnyCPU</PlatformTarget>

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"FileRename": "_BenchmarkName_",
3030
"replaces": "$(BenchmarkName)"
3131
},
32-
"frameworks": {
32+
"framework": {
3333
"type": "parameter",
3434
"datatype": "string",
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",
35+
"description": "The target framework for the project (e.g. netstandard2.0). Default \"net5.0\" if \"--console-app\" is true, \"netstandard2.0\" if \"--console-app\" is false",
3636
"defaultValue": ""
3737
},
38-
"frameworksDefaults": {
38+
"frameworkDefault": {
3939
"type": "generated",
4040
"generator": "switch",
4141
"description": "generate a default framework value based on consoleApp",
@@ -44,38 +44,37 @@
4444
"datatype": "string",
4545
"cases": [
4646
{
47-
"condition": "(frameworks == '' && consoleApp == true)",
47+
"condition": "(framework == '' && consoleApp == true)",
4848
"value": "net5.0"
4949
},
5050
{
51-
"condition": "(frameworks == '' && consoleApp == false)",
51+
"condition": "(framework == '' && consoleApp == false)",
5252
"value": "netstandard2.0"
5353
},
5454
{
55-
"condition": "(frameworks != '')",
55+
"condition": "(framework != '')",
5656
"value": ""
5757
}
5858
]
59-
},
60-
"replaces": "$(Frameworks)"
59+
}
6160
},
62-
"frameworksValue": {
61+
"frameworkValue": {
6362
"type": "generated",
6463
"generator": "join",
65-
"description": "join frameworks and frameworksDefaults",
64+
"description": "join framework and frameworkDefault",
6665
"parameters": {
6766
"symbols": [
6867
{
6968
"type": "ref",
70-
"value": "frameworks"
69+
"value": "framework"
7170
},
7271
{
7372
"type": "ref",
74-
"value": "frameworksDefaults"
73+
"value": "frameworkDefault"
7574
}
7675
]
7776
},
78-
"replaces": "$(Frameworks)"
77+
"replaces": "$(Framework)"
7978
},
8079
"config": {
8180
"type": "parameter",
@@ -99,7 +98,7 @@
9998
"type": "parameter",
10099
"datatype": "string",
101100
"description": "Version of BenchmarkDotNet that will be referenced.",
102-
"defaultValue": "0.12.0",
101+
"defaultValue": "0.12.1",
103102
"replaces": "$(BenchmarkDotNetVersion)"
104103
}
105104
},

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>$(Frameworks)</TargetFrameworks>
2+
<PropertyGroup Condition="'$(consoleApp)' == 'true'">
3+
<TargetFramework>$(Framework)</TargetFramework>
4+
<OutputType>Exe</OutputType>
5+
</PropertyGroup>
6+
<PropertyGroup Condition="'$(consoleApp)' == 'false'">
7+
<TargetFramework>$(Framework)</TargetFramework>
48
</PropertyGroup>
59
<PropertyGroup>
610
<PlatformTarget>AnyCPU</PlatformTarget>

0 commit comments

Comments
 (0)