Skip to content
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

Update the sdk target to net10.0 #43015

Merged
merged 71 commits into from
Nov 5, 2024

Conversation

v-wuzhai
Copy link
Member

No description provided.

@v-wuzhai v-wuzhai requested a review from a team as a code owner October 8, 2024 03:04
@v-wuzhai
Copy link
Member Author

v-wuzhai commented Oct 8, 2024

There are a bunch of template test failure error messages as follows:

warning MSB4011: "/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/Tests.targets" cannot be imported again. It was already imported at "/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/Imports.targets (12,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/Users/runner/work/1/s/artifacts/tmp/Release/dotnet-new.IntegrationTests/Restore_Basic/20241008062742474/Target/Output/MyProject.csproj]\n/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/GenerateChecksums.targets(4,71):
error MSB4022: The result "" of evaluating the value "$(ArcadeSdkBuildTasksAssembly)" of the "AssemblyFile" attribute in element is not valid. [/Users/runner/work/1/s/artifacts/tmp/Release/dotnet-new.IntegrationTests/Restore_Basic/20241008062742474/Target/Output/MyProject.csproj]\nStdErr:\nRestore failed.\nPost action failed.\nManual instructions: Run 'dotnet restore'\n

@dotnet/templating-engine-maintainers @dotnet/arcade-contrib Could you please take a look at this issue?

<ToolsetTargetFramework>$(SdkTargetFramework)</ToolsetTargetFramework>
<VisualStudioServiceTargetFramework>net8.0</VisualStudioServiceTargetFramework>

<!-- We used to have scenarios where the MSBuild host (VSMac) had an older .NET, but don't any more. -->
<ResolverTargetFramework>$(SdkTargetFramework)</ResolverTargetFramework>
<ResolverTargetFramework>net9.0</ResolverTargetFramework>
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is the build error message when set to net10.0.

C:\Users\AzureTest\Desktop\109\sdk\.dotnet\sdk\10.0.100-alpha.1.24507.21\Microsoft.Common.CurrentVersion.targets(1889,5): error NU1702: ProjectReference 'C:\Users\AzureTest\Desktop\109\sdk\test\Microsoft.NET.TestFramework\Microsoft.NET.TestFramework.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v9.0'. This project may not be fully compatible with your project. C:\Users\AzureTest\Desktop\109\sdk\.dotnet\sdk\10.0.100-alpha.1.24507.21\Microsoft.Common.CurrentVersion.targets(1889,5): error NU1702: ProjectReference 'C:\Users\AzureTest\Desktop\109\sdk\src\Cli\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v9.0'. This project may not be fully compatible with your project.

@kasperk81
Copy link
Contributor

warning MSB4011: "/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/Tests.targets" cannot be imported again. It was already imported at "/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/Imports.targets (12,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/Users/runner/work/1/s/artifacts/tmp/Release/dotnet-new.IntegrationTests/Restore_Basic/20241008062742474/Target/Output/MyProject.csproj]\n/Users/runner/work/1/s/artifacts/.nuget/packages/microsoft.dotnet.arcade.sdk/10.0.0-beta.24504.4/tools/GenerateChecksums.targets(4,71):
error MSB4022: The result "" of evaluating the value "$(ArcadeSdkBuildTasksAssembly)" of the "AssemblyFile" attribute in element is not valid. [/Users/runner/work/1/s/artifacts/tmp/Release/dotnet-new.IntegrationTests/Restore_Basic/20241008062742474/Target/Output/MyProject.csproj]\nStdErr:\nRestore failed.\nPost action failed.\nManual instructions: Run 'dotnet restore'\n

@mmitche do you recall these errors from dotnet/arcade#12740

net10 templates are blocked

@mmitche
Copy link
Member

mmitche commented Oct 10, 2024

@kasperk81 I think the Arcade issue is a red herring. When the tests are being run, the .NET SDK imports the Directory.Build.targets from the root of the SDK repo, which then imports the arcade targets. I am pretty sure this is not intended for template tests as they aren't really testing the simple create+restore flow. In a helix run, I don't think this ends up happening because the SDK's repo content isn't on the machine, so that's good.

There is a Directory.Build.props file that is set up as part of the test run in the test temp dir. I think there needs to be a corresponding Directory.Build.targets alongside it to avoid accidentally importing Directory.Build..targets from the SDK repo.

/cc @nagilson and @marcpopMSFT

@kasperk81
Copy link
Contributor

kasperk81 commented Oct 10, 2024

/Users/runner/work/1/s/test/UnitTests.proj(109,5): error MSB3030: Could not copy the file "/Users/runner/work/1/s/artifacts/tmp/Release/NuGet.config" because it was not found.
##[error]test/UnitTests.proj(109,5): error MSB3030: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not copy the file "/Users/runner/work/1/s/artifacts/tmp/Release/NuGet.config" because it was not found.

these are persistent. when is nuget.config gets copied in artifacts?

vmr is dotnet/arcade#15153 (comment) (need arcade bump, applies to all prs not just this one)

@mmitche
Copy link
Member

mmitche commented Oct 10, 2024

@kasperk81 It's due to this change:

https://github.com/dotnet/sdk/pull/43015/files#diff-37aabd56f54205e41e1a83387bfefad4ff62b60b0ec360e3beb1160d1c635722R20

That causes the targets in src/Tests/Microsoft.NET.TestFramework/SetupTestRoot.targets to not run. I think the conditionals in that file look pretty suspect. I'm guessing they were working around some race condition.

@mmitche
Copy link
Member

mmitche commented Oct 10, 2024

dotnet-format uses NetCurrent right now. I think it should be using SdkTargetFramework

@lewing
Copy link
Member

lewing commented Nov 4, 2024

@javiercn one of the blazor tests needs an update it looks like. Is that you who should take a look? Expected manifest Identity of ${ProjectPath}\Client\obj\Debug${Tfm}\blazor.publish.boot.json but found ${ProjectPath}\Client\obj\Debug${Tfm}\publish.blazor.boot.json. Expected manifest OriginalItemSpec of ${ProjectPath}\Client\obj\Debug${Tfm}\blazor.publish.boot.json but found ${ProjectPath}\Client\obj\Debug${Tfm}\publish.blazor.boot.json.

This is expected, we should just change the test here. cc @maraf

@am11
Copy link
Member

am11 commented Nov 4, 2024

Looks like it needs merge-from-main.

@ViktorHofer
Copy link
Member

The added patch should fix the wpf SDK mismatch issue but I wouldn't be surprised if that repo needs an additional change due to BCL changes. Let's see.

@maraf
Copy link
Member

maraf commented Nov 5, 2024

@javiercn one of the blazor tests needs an update it looks like. Is that you who should take a look?

Resolved by merging main

@ViktorHofer
Copy link
Member

ViktorHofer commented Nov 5, 2024

D:\a_work\1\vmr.dotnet\sdk\10.0.100-alpha.1.24551.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'D:\a_work\1\vmr\src\wpf\artifacts\obj\Microsoft.NET.Sdk.WindowsDesktop.ArchNeutral\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [D:\a_work\1\vmr\src\wpf\packaging\Microsoft.NET.Sdk.WindowsDesktop\Microsoft.NET.Sdk.WindowsDesktop.ArchNeutral.csproj]

Hmm that one is annoying. The wpf repo builds with desktop msbuild. The VS version that is part of the build image is Preview 17.11.0-pre.2.1:

image

That VS installation seems to be missing dotnet/msbuild@7500f06 which updated the STJ binding redirects to 8.0.0.4. Apparently NuGet assemblies depend on the 8.0.0.4 version though. @rainersigwald ideas?

Btw I'm not sure why the windows.vs2022.preview image is lagging behind so much. It would be great if it could get updated to a VS17.12 version. Filed dotnet/dnceng#4403

@jjonescz
Copy link
Member

jjonescz commented Nov 5, 2024

@ViktorHofer
Copy link
Member

ViktorHofer commented Nov 5, 2024

Yes, the workaround is checked into the Arcade.Sdk and runs by default. The binlog shows that the target runs but the ResolvePackageAssets task is still failing:

image

@ViktorHofer
Copy link
Member

ViktorHofer commented Nov 5, 2024

OK lol, the workaround is broken with 10.0.100 SDK versions because dotnet-watch doesn't have a STJ assembly anymore:

image

Submitted dotnet/arcade#15218 to update the workaround

@ViktorHofer
Copy link
Member

ViktorHofer commented Nov 5, 2024

Now windowsdesktop (sigh). Still, all those failures are really helpful as they show us where our infrastructure could be improved.

@ViktorHofer
Copy link
Member

A bit thanks to our community contributors @am11 and @kasperk81 for helping getting this in. You are amazing! 🎉

@ViktorHofer ViktorHofer enabled auto-merge (squash) November 5, 2024 17:02
@ViktorHofer ViktorHofer merged commit ffd7663 into main Nov 5, 2024
37 checks passed
@ViktorHofer ViktorHofer deleted the dev/Jason/Update-the-sdk-target-to-net10.0 branch November 5, 2024 17:08
dipeshmsft pushed a commit to dotnet/wpf that referenced this pull request Nov 5, 2024
…ion (#10030)

* Keep apphostpack version in sync with targeting and runtime pack version

Unblocks dotnet/sdk#43015

WPF uses a "live" version of the .NETCoreApp targeting and runtime pack. Also use the live version for the apphost pack so that vcxprojs don't depend on the version inside the SDK.

* Update RuntimeFrameworkReference.targets

* Create Tools.props

* Update RuntimeFrameworkReference.targets

* Update RuntimeFrameworkReference.targets

* Update RuntimeFrameworkReference.targets

* Update Tools.props

* PR feedback and adding comments

* Add more comments and consider version properties in conditions
@am11
Copy link
Member

am11 commented Nov 5, 2024

Haha, classic move! Sometimes all it takes is a well-timed game-changing commit like I hate patches.patch to solve the mystery! 😜 Huge props to @ViktorHofer and others for the detective work! 🕵️‍♂️🏆

ViktorHofer added a commit to dotnet/wpf that referenced this pull request Nov 6, 2024
Fixes #9490
Unblocks dotnet/sdk#43015

When building wpf inside the VMR, a 10.0.100 SDK is used. WPF currently still targets net9.0. As WPF directly depends on runtime, it already uses 10.0.0-alpha versions of the targeting and runtime packs for managed projects.

Enable this for vcxprojs as well so that the host packages can also be restored from the flowing runtime dependency.

Fixes errors like these:

> The Apphost pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit   https://aka.ms/targeting-apphost-pack-missing  Pack Type:Apphost, Pack directory: D:\a\_work\1\vmr\.dotnet\packs\Microsoft.NETCore.App.Host.win-x64, targetframework: net9.0, Pack PackageId: Microsoft.NETCore.App.Host.win-x64, Pack Package Version: 9.0.0-rc.2.24473.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.