Skip to content

Commit d434098

Browse files
Update to .NET 8 (#653)
- Update to .NET 8. - Fix new code analysis warnings. - Use `UseArtifactsOutput=true` instead of explicitly setting the output path, as well as dropping explicit use of `--configuration` now that the default is `Release`. - Remove `Microsoft.SourceLink.GitHub` as it is now included in the .NET SDK. - Use `TimeProvider`. - Use primary constructors where relevant. - Use collection literals where relevant. - Apply some IDE suggestions. - Fix some typos. - Remove `CommonAssemblyInfo`. - Remove redundant suppressions. - Remove field with an array to use the `char` overload of `TrimEnd()` for .NET 6+ and an inline collection literal for .NET Standard 2.0. - Use the new MSBuild terminal logger. - Bump version to 3.3.0. - Bump Microsoft.Data.SqlClient to 5.1.2 for `net8.0`.
1 parent e502e85 commit d434098

47 files changed

Lines changed: 187 additions & 286 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ indent_style = space
99
insert_final_newline = true
1010
trim_trailing_whitespace = true
1111

12+
# Visual Studio Spell Checker
13+
spelling_exclusion_path = .\exclusion.dic
14+
spelling_languages = en-us
15+
1216
[*.{config,csproj,json,props,ruleset,targets,vsconfig,yml}]
1317
indent_size = 2
1418

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
5858
name: Upload coverage to Codecov
5959
with:
60-
file: ./artifacts/coverage/coverage.net7.0.cobertura.xml
60+
file: ./artifacts/coverage/coverage.net8.0.cobertura.xml
6161
flags: ${{ matrix.os_name }}
6262

6363
- name: Publish artifacts
@@ -70,7 +70,7 @@ jobs:
7070
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
7171
with:
7272
name: packages-${{ matrix.os_name }}
73-
path: ./artifacts/packages
73+
path: ./artifacts/package/release
7474
if-no-files-found: error
7575

7676
validate-packages:

.vsconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"components": [
44
"Microsoft.VisualStudio.Component.CoreEditor",
55
"Microsoft.VisualStudio.Workload.CoreEditor",
6-
"Microsoft.NetCore.Component.Runtime.7.0",
6+
"Microsoft.NetCore.Component.Runtime.8.0",
77
"Microsoft.NetCore.Component.SDK",
88
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
99
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices"

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CHANGELOG
22

3+
<!-- markdownlint-disable MD024 -->
4+
35
## SqlLocalDb v1.0.0.0
46

57
First release.
@@ -231,3 +233,9 @@ Added overloads to support specifying the name of the Initial Catalog using the
231233
### Added
232234

233235
* Fix incorrect minimum dependency versions when targeting `net6.0`.
236+
237+
## SqlLocalDb v3.3.0
238+
239+
### Added
240+
241+
* Add `net8.0` Target Framework Moniker.

Directory.Build.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
<NeutralLanguage>en-US</NeutralLanguage>
3232
<NoWarn>$(NoWarn);CA1054;CA1848;CA2234</NoWarn>
3333
<NoWarn Condition=" '$(GenerateDocumentationFile)' != 'true' ">$(NoWarn);SA0001</NoWarn>
34+
<!--
35+
HACK Workaround for https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687
36+
-->
37+
<NoWarn>$(NoWarn);SA1010</NoWarn>
3438
<Nullable>enable</Nullable>
3539
<PackageIcon></PackageIcon>
3640
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
@@ -47,7 +51,8 @@
4751
<StrongNamePublicKey Condition=" '$(SignAssembly)' == 'true'">00240000048000009400000006020000002400005253413100040000010001004b0b2efbada897147aa03d2076278890aefe2f8023562336d206ec8a719b06e89461c31b43abec615918d509158629f93385930c030494509e418bf396d69ce7dbe0b5b2db1a81543ab42777cb98210677fed69dbeb3237492a7ad69e87a1911ed20eb2d7c300238dc6f6403e3d04a1351c5cb369de4e022b18fbec70f7d21ed</StrongNamePublicKey>
4852
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
4953
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
50-
<VersionPrefix>3.2.1</VersionPrefix>
54+
<UseArtifactsOutput>true</UseArtifactsOutput>
55+
<VersionPrefix>3.3.0</VersionPrefix>
5156
<VersionSuffix Condition=" '$(VersionSuffix)' == '' AND '$(GITHUB_ACTIONS)' != '' ">beta$([System.Convert]::ToInt32(`$(GITHUB_RUN_NUMBER)`).ToString(`0000`))</VersionSuffix>
5257
<VersionPrefix Condition=" $(GITHUB_REF.StartsWith(`refs/tags/v`)) ">$(GITHUB_REF.Replace('refs/tags/v', ''))</VersionPrefix>
5358
<VersionSuffix Condition=" $(GITHUB_REF.StartsWith(`refs/tags/v`)) "></VersionSuffix>

Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
</ItemGroup>
2020
</Target>
2121
<PropertyGroup Condition=" '$(CollectCoverage)' == 'true' ">
22-
<CoverletOutput>$([System.IO.Path]::Combine($(OutputPath), 'coverage', 'coverage'))</CoverletOutput>
22+
<CoverletOutput>$([System.IO.Path]::Combine($(ArtifactsPath), 'coverage', 'coverage'))</CoverletOutput>
2323
<ReportGeneratorOutputMarkdown Condition=" '$(ReportGeneratorOutputMarkdown)' == '' AND '$(GITHUB_SHA)' != '' ">true</ReportGeneratorOutputMarkdown>
2424
<ReportGeneratorReportTypes>HTML</ReportGeneratorReportTypes>
2525
<ReportGeneratorReportTypes Condition=" '$(ReportGeneratorOutputMarkdown)' == 'true' ">$(ReportGeneratorReportTypes);MarkdownSummaryGitHub</ReportGeneratorReportTypes>
26-
<ReportGeneratorTargetDirectory>$([System.IO.Path]::Combine($(OutputPath), 'coverage'))</ReportGeneratorTargetDirectory>
26+
<ReportGeneratorTargetDirectory>$([System.IO.Path]::Combine($(ArtifactsPath), 'coverage'))</ReportGeneratorTargetDirectory>
2727
<_MarkdownSummaryPrefix>&lt;details&gt;&lt;summary&gt;:chart_with_upwards_trend: &lt;b&gt;$(AssemblyName) Code Coverage report&lt;/b&gt;&lt;/summary&gt;</_MarkdownSummaryPrefix>
2828
<_MarkdownSummarySuffix>&lt;/details&gt;</_MarkdownSummarySuffix>
2929
</PropertyGroup>

Directory.Packages.props

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
<Project>
2-
<PropertyGroup>
3-
<NodaTimeVersion>3.1.9</NodaTimeVersion>
4-
</PropertyGroup>
52
<ItemGroup>
63
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
74
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
85
<PackageVersion Include="Humanizer" Version="2.14.1" />
96
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
107
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
11-
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
8+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
9+
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.0.0" />
1210
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
13-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
1411
<PackageVersion Include="NSubstitute" Version="5.1.0" />
15-
<PackageVersion Include="NodaTime" Version="$(NodaTimeVersion)" />
16-
<PackageVersion Include="NodaTime.Testing" Version="$(NodaTimeVersion)" />
1712
<PackageVersion Include="ReportGenerator" Version="5.1.26" />
1813
<PackageVersion Include="Shouldly" Version="4.2.1" />
1914
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
@@ -32,14 +27,18 @@
3227
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
3328
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
3429
</ItemGroup>
30+
<ItemGroup Condition=" '$(AssemblyName)' == 'MartinCostello.SqlLocalDb' and '$(TargetFramework)' == 'net8.0' ">
31+
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.2" />
32+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
33+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
34+
</ItemGroup>
3535
<ItemGroup Condition=" '$(AssemblyName)' != 'MartinCostello.SqlLocalDb' ">
3636
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.2" />
37-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
38-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" />
39-
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
37+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
38+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
39+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
4040
</ItemGroup>
4141
<ItemGroup>
42-
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
4342
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />
4443
</ItemGroup>
4544
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">

build.ps1

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#Requires -PSEdition Core
44
#Requires -Version 7
55

6-
param(
7-
[Parameter(Mandatory = $false)][string] $Configuration = "Release",
8-
[Parameter(Mandatory = $false)][string] $OutputPath = ""
9-
)
6+
param()
107

118
$env:DOTNET_MULTILEVEL_LOOKUP = "0"
129
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"
@@ -29,10 +26,6 @@ $testProjects = @(
2926

3027
$dotnetVersion = (Get-Content $sdkFile | Out-String | ConvertFrom-Json).sdk.version
3128

32-
if ($OutputPath -eq "") {
33-
$OutputPath = (Join-Path $solutionPath "artifacts")
34-
}
35-
3629
$installDotNetSdk = $false;
3730

3831
if (($null -eq (Get-Command "dotnet" -ErrorAction SilentlyContinue)) -and ($null -eq (Get-Command "dotnet.exe" -ErrorAction SilentlyContinue))) {
@@ -90,14 +83,7 @@ if ($installDotNetSdk -eq $true) {
9083
function DotNetPack {
9184
param([string]$Project)
9285

93-
$PackageOutputPath = (Join-Path $OutputPath "packages")
94-
95-
& $dotnet pack `
96-
$Project `
97-
--output $PackageOutputPath `
98-
--configuration $Configuration `
99-
--include-source `
100-
--include-symbols
86+
& $dotnet pack $Project --include-source --include-symbols --tl
10187

10288
if ($LASTEXITCODE -ne 0) {
10389
throw "dotnet pack failed with exit code $LASTEXITCODE"
@@ -114,11 +100,7 @@ function DotNetTest {
114100
$additionalArgs += "GitHubActions;report-warnings=false"
115101
}
116102

117-
& $dotnet test `
118-
$Project `
119-
--output $OutputPath `
120-
--configuration $Configuration `
121-
$additionalArgs
103+
& $dotnet test $Project --configuration "Release" --tl $additionalArgs
122104

123105
if ($LASTEXITCODE -ne 0) {
124106
throw "dotnet test failed with exit code $LASTEXITCODE"
@@ -131,7 +113,6 @@ ForEach ($project in $packageProjects) {
131113
}
132114

133115
Write-Host "Testing $($testProjects.Count) project(s)..." -ForegroundColor Green
134-
Remove-Item -Path (Join-Path $OutputPath "coverage.*.json") -Force -ErrorAction SilentlyContinue | Out-Null
135116
ForEach ($project in $testProjects) {
136117
DotNetTest $project
137118
}

exclusion.dic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
callback
2+
Unshare

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.403",
3+
"version": "8.0.100",
44
"allowPrerelease": false,
55
"rollForward": "latestMajor"
66
}

0 commit comments

Comments
 (0)