diff --git a/CHANGELOG.md b/CHANGELOG.md index d2abb6f60..4f5bc6e27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,11 @@ All notable changes to **bUnit** will be documented in this file. The project ad ## [Unreleased] -## Changed +### Added + +- Update bunit templates to support the target framework version of the project. By [@linkdotnet](https://github.com/linkdotnet). + +### Changed - Change all bUnit services registration from singleton to scoped. By [@egil](https://github.com/egil). Closes https://github.com/bUnit-dev/bUnit/issues/1138. diff --git a/src/bunit.template/template/.template.config/dotnetcli.host.json b/src/bunit.template/template/.template.config/dotnetcli.host.json index d78ed2e98..25f3a28b9 100644 --- a/src/bunit.template/template/.template.config/dotnetcli.host.json +++ b/src/bunit.template/template/.template.config/dotnetcli.host.json @@ -7,11 +7,15 @@ "UnitTestFramework": { "longName": "framework", "shortName": "" + }, + "TargetSdk": { + "longName": "sdk", + "shortName": "" } }, "usageExamples": [ - "--framework xunit", - "--framework nunit", - "--framework mstest" + "--framework xunit --sdk net7.0", + "--framework nunit --sdk net7.0", + "--framework mstest --sdk net7.0" ] } diff --git a/src/bunit.template/template/.template.config/template.json b/src/bunit.template/template/.template.config/template.json index 47766b885..f926c5c55 100644 --- a/src/bunit.template/template/.template.config/template.json +++ b/src/bunit.template/template/.template.config/template.json @@ -76,6 +76,31 @@ "testFramework_mstest": { "type": "computed", "value": "UnitTestFramework == \"mstest\"" + }, + "targetSdk": { + "type": "parameter", + "description": "The target framework sdk for the project.", + "displayName": "Target framework sdk", + "datatype": "choice", + "defaultValue": "net7.0", + "replaces": "targetSdk", + "choices": [ + { + "choice": "net6.0", + "description": ".net 6.0", + "displayName": ".net 6.0" + }, + { + "choice": "net7.0", + "description": ".net 7.0", + "displayName": ".net 7.0" + }, + { + "choice": "net8.0", + "description": ".net 8.0", + "displayName": ".net 8.0" + } + ] } }, "primaryOutputs": [ diff --git a/src/bunit.template/template/Company.BlazorTests1.csproj b/src/bunit.template/template/Company.BlazorTests1.csproj index 2fb52dda9..143b9c82e 100644 --- a/src/bunit.template/template/Company.BlazorTests1.csproj +++ b/src/bunit.template/template/Company.BlazorTests1.csproj @@ -1,7 +1,7 @@ - net6.0 + targetSdk enable false @@ -17,29 +17,29 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - + +