Skip to content

Update to net8.0 SDK #45879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,22 +302,22 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>9197fd555152762b2f400459d46cb14ad741bf75</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23055.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>7502a87ca569989008d3acef120b614604b6805f</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.23055.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>7502a87ca569989008d3acef120b614604b6805f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="8.0.0-beta.23055.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>7502a87ca569989008d3acef120b614604b6805f</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.23055.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>7502a87ca569989008d3acef120b614604b6805f</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
<MicrosoftEntityFrameworkCoreVersion>8.0.0-alpha.1.23056.1</MicrosoftEntityFrameworkCoreVersion>
<MicrosoftEntityFrameworkCoreDesignVersion>8.0.0-alpha.1.23056.1</MicrosoftEntityFrameworkCoreDesignVersion>
<!-- Packages from dotnet/arcade -->
<MicrosoftDotNetBuildTasksInstallersVersion>8.0.0-beta.22630.1</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>8.0.0-beta.22630.1</MicrosoftDotNetBuildTasksTemplatingVersion>
<MicrosoftDotNetBuildTasksInstallersVersion>8.0.0-beta.23055.3</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksTemplatingVersion>8.0.0-beta.23055.3</MicrosoftDotNetBuildTasksTemplatingVersion>
<!-- Packages from dotnet/source-build-externals -->
<MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>8.0.0-alpha.1.22615.1</MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>
<!-- Packages from dotnet/xdt -->
Expand Down
6 changes: 3 additions & 3 deletions eng/common/templates/job/source-index-stage1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
runAsPublic: false
sourceIndexPackageVersion: 1.0.1-20220804.1
sourceIndexPackageVersion: 1.0.1-20221220.2
sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
preSteps: []
Expand Down Expand Up @@ -40,10 +40,10 @@ jobs:
- ${{ preStep }}

- task: UseDotNet@2
displayName: Use .NET Core sdk 3.1
displayName: Use .NET Core SDK 6
inputs:
packageType: sdk
version: 3.1.x
version: 6.0.x
installationPath: $(Agent.TempDirectory)/dotnet
workingDirectory: $(Agent.TempDirectory)

Expand Down
4 changes: 3 additions & 1 deletion eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net7.0' }
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' }
} elseif ($msbuildEngine -eq "vs") {
try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
Expand Down Expand Up @@ -743,6 +743,8 @@ function MSBuild() {
(Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll'))
)
$selectedPath = $null
foreach ($path in $possiblePaths) {
Expand Down
4 changes: 3 additions & 1 deletion eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function InitializeBuildTool {
# return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild"
_InitializeBuildToolFramework="net7.0"
_InitializeBuildToolFramework="net8.0"
}

# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
Expand Down Expand Up @@ -428,6 +428,8 @@ function MSBuild {
possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" )
for path in "${possiblePaths[@]}"; do
if [[ -f $path ]]; then
selectedPath=$path
Expand Down
14 changes: 14 additions & 0 deletions eng/tools/GenerateFiles/Directory.Build.targets.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,18 @@
<Warning Text="Requested Microsoft.AspNetCore.App v${MicrosoftAspNetCoreAppRuntimeVersion} does not exist."
Condition=" !EXISTS('$(_DotNetRoot)shared\Microsoft.AspNetCore.App\${MicrosoftAspNetCoreAppRuntimeVersion}') " />
</Target>

<!--
Make a netstandard2.1 copy of the .net ILLinkPack to work around a trimming issue.
See https://github.com/dotnet/linker/issues/3175
-->
<Target Name="_FixKnownILLinkPack"
BeforeTargets="ProcessFrameworkReferences">
<ItemGroup>
<KnownILLinkPack Include="@(KnownILLinkPack)"
Condition="'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}'"
TargetFramework="netstandard2.1"
ILLinkPackVersion="%(KnownILLinkPack.ILLinkPackVersion)" />
</ItemGroup>
</Target>
</Project>
4 changes: 2 additions & 2 deletions eng/tools/RepoTasks/RepoTasks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes here cannot work until we have an 8.0.0 SDK containing net8.0 bits. The basic idea is RepoTasks and GenerateFiles aren't part of the product. They're instead used in msbuild (or dotnet msbuild) and to generate the extra Directory.Build.props, Directory.Build.targets, and dotnet-tools.json files used in almost every other project in the repo.

Why did this file and RepoTasks.tasks need to change in the first place❔ Note GenerateFiles still targets net5.0 and (other than the deprecated TFM warning we're suppressing somewhere) that's fine.

See for example

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Copy link
Member Author

@wtgodbe wtgodbe Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's why this is blocked on dotnet/installer#15151 as I mentioned above. It needs to change because SourceBuild breaks if it doesn't target the latest TFM (though I don't know why the same isn't true for GenerateFiles) - dotnet/installer#15151 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though I don't know why the same isn't true for GenerateFiles

@dougbu @wtgodbe, GenerateFiles.csproj doesn't need to use the latest TFM because it doesn't build during source-build:

<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>

<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
<DefineConstants Condition="'$(TargetFramework)' == 'net472'">$(DefineConstants);BUILD_MSI_TASKS</DefineConstants>
<Optimize>false</Optimize>
Expand All @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" />
Expand Down
2 changes: 1 addition & 1 deletion eng/tools/RepoTasks/RepoTasks.tasks
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">net7.0</_RepoTaskAssemblyFolder>
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">$(DefaultNetCoreTargetFramework)</_RepoTaskAssemblyFolder>
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_RepoTaskAssemblyFolder>
<_RepoTaskAssembly>$(ArtifactsBinDir)RepoTasks\Release\$(_RepoTaskAssemblyFolder)\RepoTasks.dll</_RepoTaskAssembly>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"sdk": {
"version": "8.0.100-alpha.1.22531.1"
"version": "8.0.100-alpha.1.23055.1"
},
"tools": {
"dotnet": "8.0.100-alpha.1.22531.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the new SDK, I believe we will need to update the CI pipeline to use the binlogtosln that supports v15 (dotnet/arcade#11995), if it is not updated yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just merged that PR into this one

"dotnet": "8.0.100-alpha.1.23055.1",
"runtimes": {
"dotnet/x86": [
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"
Expand All @@ -27,7 +27,7 @@
},
"msbuild-sdks": {
"Yarn.MSBuild": "1.22.10",
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22630.1",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22630.1"
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23055.3",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23055.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<SelfContained>true</SelfContained>
<UseMonoRuntime>true</UseMonoRuntime>
<UsingMicrosoftNETSdkBlazorWebAssembly>true</UsingMicrosoftNETSdkBlazorWebAssembly>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Metadata" />
Expand Down
1 change: 1 addition & 0 deletions src/Servers/IIS/IIS/test/IIS.Tests/IIS.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<InProcessTestSite>true</InProcessTestSite>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);CA2200</NoWarn>
</PropertyGroup>

<Import Project="../FunctionalTest.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ private async Task SubscribeToConnection(HubConnectionContext connection)
}
catch (Exception ex)
{
RedisLog.ErrorForwardingResult(_logger, completionMessage.InvocationId, ex);
RedisLog.ErrorForwardingResult(_logger, completionMessage.InvocationId!, ex);
}
}));

Expand Down
1 change: 1 addition & 0 deletions src/Tools/LinkabilityChecker/LinkabilityChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<Import Project="$(RepoRoot)eng\TrimmableProjects.props" />
Expand Down