Skip to content

Commit

Permalink
Build and test against .NET 8 (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl committed Nov 15, 2023
1 parent 7d2a264 commit b9b988d
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 20 deletions.
12 changes: 5 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MicrosoftBuildPackageVersion>17.7.2</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">16.9.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net46'">15.9.20</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">17.7.2</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion>17.8.3</MicrosoftBuildPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CopyOnWrite" Version="0.3.7" Condition=" '$(TargetFramework)' != 'net46' " />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Update="Microsoft.Build.Utilities.Core" Version="16.9.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageVersion Update="Microsoft.Build.Utilities.Core" Version="15.9.20" Condition="'$(TargetFramework)' == 'net46'" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Update="Microsoft.Build.Tasks.Core" Version="16.9.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageVersion Update="Microsoft.Build.Tasks.Core" Version="15.9.20" Condition="'$(TargetFramework)' == 'net46'" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="System.CodeDom" Version="7.0.0" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="6.0.0" Condition=" '$(TargetFramework)' != 'net46' " />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="7.0.0" Condition=" '$(TargetFramework)' != 'net46' " />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="4.11.1" Condition=" '$(TargetFramework)' == 'net46' " />
</ItemGroup>
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
Expand Down
1 change: 0 additions & 1 deletion azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ stages:
displayName: 'Install .NET $(DotNetVersion)'
inputs:
version: '$(DotNetVersion)'
includePreviewVersions: true

- task: MicroBuildSigningPlugin@4
displayName: 'Install MicroBuild Signing Plugin'
Expand Down
40 changes: 40 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ variables:
BuildPlatform: 'Any CPU'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
DotNet8Version: '8.x'
MSBuildArgs: '"/p:Platform=$(BuildPlatform)" "/p:Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
SignType: 'Test'

Expand Down Expand Up @@ -45,6 +46,11 @@ jobs:
inputs:
version: '$(DotNet7Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'

- task: DotNetCoreCLI@2
displayName: 'Build Solution'
inputs:
Expand Down Expand Up @@ -75,6 +81,14 @@ jobs:
testRunTitle: 'Windows .NET 7.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 8.0)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net8.0 /noautorsp'
testRunTitle: 'Windows .NET 8.0'
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
Expand All @@ -98,6 +112,11 @@ jobs:
inputs:
version: '$(DotNet7Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'

- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
Expand All @@ -120,6 +139,14 @@ jobs:
testRunTitle: 'Linux .NET 7.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 8.0)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net8.0 /noautorsp'
testRunTitle: 'Linux .NET 8.0'
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
Expand All @@ -143,6 +170,11 @@ jobs:
inputs:
version: '$(DotNet7Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'

- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
Expand All @@ -165,6 +197,14 @@ jobs:
testRunTitle: 'MacOS .NET 7.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 8.0)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net8.0 /noautorsp'
testRunTitle: 'MacOS .NET 8.0'
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
Expand Down
5 changes: 2 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"sdk": {
"version": "7.0.100",
"rollForward": "latestMajor",
"allowPrerelease": true
"version": "8.0.100",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AssemblyShader" />
Expand Down
2 changes: 1 addition & 1 deletion src/Artifacts/Microsoft.Build.Artifacts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="CopyOnWrite"
GeneratePathProperty="True"
PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core"
<PackageReference Include="Microsoft.Build.Tasks.Core"
ExcludeAssets="Runtime"
PrivateAssets="All" />
<PackageReference Include="System.Threading.Tasks.Dataflow"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>Enable</Nullable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CopyOnWrite/MSBuild/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ internal static bool IsMaxPathLegacyWindows()

private static bool IsLongPathsEnabledRegistry()
{
using (RegistryKey fileSystemKey = Registry.LocalMachine.OpenSubKey(WINDOWS_FILE_SYSTEM_REGISTRY_KEY))
using (RegistryKey? fileSystemKey = Registry.LocalMachine.OpenSubKey(WINDOWS_FILE_SYSTEM_REGISTRY_KEY))
{
object? longPathsEnabledValue = fileSystemKey?.GetValue(WINDOWS_LONG_PATHS_ENABLED_VALUE_NAME, 0);
return fileSystemKey != null && Convert.ToInt32(longPathsEnabledValue) == 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AssemblyShader" />
Expand Down
6 changes: 4 additions & 2 deletions src/NoTargets.UnitTests/NoTargetsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ public void DoNotReferenceOutputAssemblies()
{
ProjectCreator projectA = ProjectCreator.Templates.SdkCsproj(
path: Path.Combine(TestRootPath, "ProjectA", "ProjectA.csproj"),
#if NETFRAMEWORK || NET7_0
targetFramework: "net7.0")
#if NETFRAMEWORK || NET8_0
targetFramework: "net8.0")
#elif NET6_0
targetFramework: "net6.0")
#elif NET7_0
targetFramework: "net7.0")
#endif
.Save();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AssemblyShader" />
Expand Down

0 comments on commit b9b988d

Please sign in to comment.