Upgraded to .net7.0/v11
Switched to dotnet 6.0 & 7.0
dotnet required console rather than Console
Include pre-release for setup-dotnet
Update LocalesTest.yml
Updated tests to support different versions of .NET
Updated to C# 11.0
Modified for GitHub build actions.
MODIFY
.github/workflows/LocalesTest.yml
.github/workflows/LocalesTest.yml
@@ -19,9 +19,9 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
- 3.1.x
- 5.x
6.x
+ 7.x
+ include-prerelease: true
- name: Get Build Information
run: |
pwd

MODIFY
.github/workflows/build-and-test.yml
.github/workflows/build-and-test.yml
-name: Build and Test v9.0
+name: Build and Test v11.0
on:
push:
@@ -22,9 +22,9 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
- 3.1.x
- 5.x
6.x
+ 7.x
+ include-prerelease: true
- name: Get Build Information
run: |
pwd

MODIFY
Common.props
Common.props
<Project>
<PropertyGroup>
- <TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
+ <TargetFrameworks>net7.0;net6.0</TargetFrameworks>
</PropertyGroup>
</Project>
\ No newline at end of file

MODIFY
Directory.Build.props
Directory.Build.props
<Project>
<PropertyGroup>
- <LangVersion>preview</LangVersion>
+ <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
+ <ImplicitUsings>enable</ImplicitUsings>
<ProductName Condition="'$(ProductName)'==''">Chapter$(ChapterNumber)</ProductName>
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)'==''">false</TreatWarningsAsErrors>
<Authors>Mark Michaelis</Authors>

MODIFY
global.json
global.json
{
"sdk": {
- "version": "6.0.0",
- "rollForward": "latestMinor",
- "allowPrerelease": false
+ "rollForward": "latestPatch",
+ "allowPrerelease": true
}
}
\ No newline at end of file

MODIFY
src/Chapter01/Chapter01.csproj
src/Chapter01/Chapter01.csproj
unexpected exception as concept to check for null hasn't been explained yet-->
<IgnoredWarnings>$(IgnoredWarnings),CS8600,CA1052,IDE0059,IDE0060</IgnoredWarnings>
<StartupObject>AddisonWesley.Michaelis.EssentialCSharp.Shared.Program</StartupObject>
- <ImplicitUsings>Enable</ImplicitUsings>
</PropertyGroup>
<Import Project="..\Chapter.props" />
<ItemGroup>

MODIFY
src/Chapter01/Listing01.02.SampleNETCoreConsoleProjectFile.cs
src/Chapter01/Listing01.02.SampleNETCoreConsoleProjectFile.cs
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>
#endregion INCLUDE
\ No newline at end of file

MODIFY
src/Chapter02/Listing02.13.UsingTheNewlineCharacterToInsertANewline.cs
src/Chapter02/Listing02.13.UsingTheNewlineCharacterToInsertANewline.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_13
{
- #region INCLUDE
public class DuelOfWits
{
public static void Main()
{
+ #region INCLUDE
System.Console.Write(
"\"Truly, you have a dizzying intellect.\"");
System.Console.Write("\n\"Wait 'til I get going!\"\n");
+ #endregion INCLUDE
}
}
- #endregion INCLUDE
}

MODIFY
src/Chapter02/Listing02.14.DisplayingATriangleUsingAVerbatimStringLiteral.cs
src/Chapter02/Listing02.14.DisplayingATriangleUsingAVerbatimStringLiteral.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_14
{
- #region INCLUDE
public class Triangle
{
public static void Main()
{
+ #region INCLUDE
System.Console.Write(@"begin
/\
/ \
@@ -12,7 +12,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_14
/ \
/________\
end");
+ #endregion INCLUDE
}
}
- #endregion INCLUDE
}

ADD
src/Chapter02/Listing02.14B.RawLiteralStrings.cs
+namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_14B
+{
+ public class Triangle
+ {
+ public static void Main()
+ {
+ #region INCLUDE
+// System.Console.Write(
+// """begin
+// ____
+// / /\
+// /___/ \
+// / s /\ /\
+// / u / \/ \
+// / i / /\ \
+// / b / / \ \
+// / o / /\ \ \
+// / m / / \ \ \
+// /___/___/____\ \ \
+// / / \ \ /\
+///___/____________\___\/ \
+//\ \ \ \ /
+// \___\_____________\___\/
+//end""");
+ #endregion INCLUDE
+ }
+ }
+}

MODIFY
src/Chapter03/Listing03.03.EnablingNullableProjectWide.cs
src/Chapter03/Listing03.03.EnablingNullableProjectWide.cs
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

MODIFY
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
@@ -5,7 +5,9 @@ param(
[int]$TraceLevel=$null
)
-if(($TraceLevel == null) -and 'TraceLevel' -notin $PSBoundParameters.Keys) {
+Set-StrictMode -Version 3.0
+
+if(($TraceLevel -eq $null) -and 'TraceLevel' -notin $PSBoundParameters.Keys) {
$TraceLevel = Read-Host -Prompt @"
Specifiy the trace level:
- 0: Turn script tracing off.
@@ -25,7 +27,7 @@ switch ($TestStage) {
Write-Host "`$projectDirectory: $projectDirectory"
Get-Item $projectDirectory -ErrorAction Ignore | Remove-Item -Recurse -Force
Set-PSDebug -Trace $TraceLevel
- dotnet new Console --output $projectDirectory
+ dotnet new console --output $projectDirectory
Set-Content (Join-Path $projectDirectory 'Directory.Build.props') '<Project><PropertyGroup><Nullable>enable</Nullable></PropertyGroup></Project>'
$SutCSFile = split-path -leaf $MyInvocation.MyCommand.Definition

ADD
src/Chapter11/Properties/launchSettings.json
+{
+ "profiles": {
+ "WSL": {
+ "commandName": "WSL2",
+ "distributionName": ""
+ }
+ }
+}
\ No newline at end of file

MODIFY
src/Chapter16.Tests/Chapter16.Tests.csproj
src/Chapter16.Tests/Chapter16.Tests.csproj
<ChapterNumber>16</ChapterNumber>
</PropertyGroup>
<Import Project="..\ChapterTests.props" />
+ <ItemGroup>
+ <Compile Include="..\Shared\NetCore.cs" Link="NetCore.cs" />
+ </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Chapter16\Chapter16.csproj" />
</ItemGroup>

Upgraded to .net7.0/v11

Switched to dotnet 6.0 & 7.0
dotnet required console rather than Console
Include pre-release for setup-dotnet
Update LocalesTest.yml
Updated tests to support different versions of .NET

Updated to C# 11.0
Modified for GitHub build actions.