From 1f7d361a83b2305b0a7c9ccd07ab76d667c37227 Mon Sep 17 00:00:00 2001 From: jonathon wei Date: Fri, 8 Jan 2021 08:49:09 +1100 Subject: [PATCH 1/2] update console app templating --- .../.template.config/template.json | 2 +- .../_BenchmarkProjectName_.csproj | 8 ++++++-- .../.template.config/template.json | 2 +- .../_BenchmarkProjectName_.fsproj | 6 +++++- .../.template.config/template.json | 2 +- .../_BenchmarkProjectName_.vbproj | 6 +++++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index ee3057ff34..56df31ccc4 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -99,7 +99,7 @@ "type": "parameter", "datatype": "string", "description": "Version of BenchmarkDotNet that will be referenced.", - "defaultValue": "0.12.0", + "defaultValue": "0.12.1", "replaces": "$(BenchmarkDotNetVersion)" } }, diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj index 783e194c29..93e007dd02 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj @@ -1,7 +1,11 @@ - - $(Frameworks) + + $(Frameworks) + Exe + + $(Frameworks) + AnyCPU portable diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index 7abd02e798..82ed1f8ba3 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -99,7 +99,7 @@ "type": "parameter", "datatype": "string", "description": "Version of BenchmarkDotNet that will be referenced.", - "defaultValue": "0.12.0", + "defaultValue": "0.12.1", "replaces": "$(BenchmarkDotNetVersion)" } }, diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj index 6e50bc89fd..e6865f1959 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj @@ -1,5 +1,9 @@  - + + $(Frameworks) + Exe + + $(Frameworks) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index 841f94dbe3..e652f0025e 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -99,7 +99,7 @@ "type": "parameter", "datatype": "string", "description": "Version of BenchmarkDotNet that will be referenced.", - "defaultValue": "0.12.0", + "defaultValue": "0.12.1", "replaces": "$(BenchmarkDotNetVersion)" } }, diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj index 783e194c29..09dcae1ebe 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj @@ -1,5 +1,9 @@ - + + $(Frameworks) + Exe + + $(Frameworks) From 9720ad6c150bfb5b1f3e44a3dfd2fa2878eb0620 Mon Sep 17 00:00:00 2001 From: jonathon wei Date: Tue, 12 Jan 2021 21:44:24 +1100 Subject: [PATCH 2/2] make single targetframework for both console app and classlib. --- .../.template.config/template.json | 25 +++++++++---------- .../_BenchmarkProjectName_.csproj | 4 +-- .../.template.config/template.json | 25 +++++++++---------- .../_BenchmarkProjectName_.fsproj | 4 +-- .../.template.config/template.json | 25 +++++++++---------- .../_BenchmarkProjectName_.vbproj | 4 +-- 6 files changed, 42 insertions(+), 45 deletions(-) diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index 56df31ccc4..d078cb9d9f 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -29,13 +29,13 @@ "FileRename": "_BenchmarkName_", "replaces": "$(BenchmarkName)" }, - "frameworks": { + "framework": { "type": "parameter", "datatype": "string", - "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", + "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", "defaultValue": "" }, - "frameworksDefaults": { + "frameworkDefault": { "type": "generated", "generator": "switch", "description": "generate a default framework value based on consoleApp", @@ -44,38 +44,37 @@ "datatype": "string", "cases": [ { - "condition": "(frameworks == '' && consoleApp == true)", + "condition": "(framework == '' && consoleApp == true)", "value": "net5.0" }, { - "condition": "(frameworks == '' && consoleApp == false)", + "condition": "(framework == '' && consoleApp == false)", "value": "netstandard2.0" }, { - "condition": "(frameworks != '')", + "condition": "(framework != '')", "value": "" } ] - }, - "replaces": "$(Frameworks)" + } }, - "frameworksValue": { + "frameworkValue": { "type": "generated", "generator": "join", - "description": "join frameworks and frameworksDefaults", + "description": "join framework and frameworkDefault", "parameters": { "symbols": [ { "type": "ref", - "value": "frameworks" + "value": "framework" }, { "type": "ref", - "value": "frameworksDefaults" + "value": "frameworkDefault" } ] }, - "replaces": "$(Frameworks)" + "replaces": "$(Framework)" }, "config": { "type": "parameter", diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj index 93e007dd02..1103a2fa11 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/_BenchmarkProjectName_.csproj @@ -1,10 +1,10 @@ - $(Frameworks) + $(Framework) Exe - $(Frameworks) + $(Framework) AnyCPU diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index 82ed1f8ba3..43d30c88cc 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -29,13 +29,13 @@ "FileRename": "_BenchmarkName_", "replaces": "$(BenchmarkName)" }, - "frameworks": { + "framework": { "type": "parameter", "datatype": "string", - "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", + "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", "defaultValue": "" }, - "frameworksDefaults": { + "frameworkDefault": { "type": "generated", "generator": "switch", "description": "generate a default framework value based on consoleApp", @@ -44,38 +44,37 @@ "datatype": "string", "cases": [ { - "condition": "(frameworks == '' && consoleApp == true)", + "condition": "(framework == '' && consoleApp == true)", "value": "net5.0" }, { - "condition": "(frameworks == '' && consoleApp == false)", + "condition": "(framework == '' && consoleApp == false)", "value": "netstandard2.0" }, { - "condition": "(frameworks != '')", + "condition": "(framework != '')", "value": "" } ] - }, - "replaces": "$(Frameworks)" + } }, - "frameworksValue": { + "frameworkValue": { "type": "generated", "generator": "join", - "description": "join frameworks and frameworksDefaults", + "description": "join framework and frameworkDefault", "parameters": { "symbols": [ { "type": "ref", - "value": "frameworks" + "value": "framework" }, { "type": "ref", - "value": "frameworksDefaults" + "value": "frameworkDefault" } ] }, - "replaces": "$(Frameworks)" + "replaces": "$(Framework)" }, "config": { "type": "parameter", diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj index e6865f1959..d86c3103e9 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/_BenchmarkProjectName_.fsproj @@ -1,10 +1,10 @@  - $(Frameworks) + $(Framework) Exe - $(Frameworks) + $(Framework) AnyCPU diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index e652f0025e..923c83620e 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -29,13 +29,13 @@ "FileRename": "_BenchmarkName_", "replaces": "$(BenchmarkName)" }, - "frameworks": { + "framework": { "type": "parameter", "datatype": "string", - "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", + "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", "defaultValue": "" }, - "frameworksDefaults": { + "frameworkDefault": { "type": "generated", "generator": "switch", "description": "generate a default framework value based on consoleApp", @@ -44,38 +44,37 @@ "datatype": "string", "cases": [ { - "condition": "(frameworks == '' && consoleApp == true)", + "condition": "(framework == '' && consoleApp == true)", "value": "net5.0" }, { - "condition": "(frameworks == '' && consoleApp == false)", + "condition": "(framework == '' && consoleApp == false)", "value": "netstandard2.0" }, { - "condition": "(frameworks != '')", + "condition": "(framework != '')", "value": "" } ] - }, - "replaces": "$(Frameworks)" + } }, - "frameworksValue": { + "frameworkValue": { "type": "generated", "generator": "join", - "description": "join frameworks and frameworksDefaults", + "description": "join framework and frameworkDefault", "parameters": { "symbols": [ { "type": "ref", - "value": "frameworks" + "value": "framework" }, { "type": "ref", - "value": "frameworksDefaults" + "value": "frameworkDefault" } ] }, - "replaces": "$(Frameworks)" + "replaces": "$(Framework)" }, "config": { "type": "parameter", diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj index 09dcae1ebe..0a50e51029 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/_BenchmarkProjectName_.vbproj @@ -1,10 +1,10 @@ - $(Frameworks) + $(Framework) Exe - $(Frameworks) + $(Framework) AnyCPU