Repository navigation
chore(samples): move the Azure Functions sample to Azure.Functions.Sdk and net11.0 - #5752
Conversation
…k and net11.0 Microsoft.Azure.Functions.Worker.Sdk won't support .NET 11; its 2.1.0 targets point to the new Azure.Functions.Sdk MSBuild SDK instead. The SDK version is pinned in global.json's msbuild-sdks: the generated obj/azure_functions/azure_functions.g.csproj references the SDK without a version, which fails to resolve in a multi-node dotnet build (MSB4236) when the version is only in the outer project's Sdk attribute. Closes #5548 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## version7 #5752 +/- ##
=========================================
Coverage 76.17% 76.17%
=========================================
Files 526 526
Lines 19265 19265
Branches 3729 3729
=========================================
Hits 14676 14676
Misses 3734 3734
Partials 855 855 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| @@ -1,18 +1,12 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| <Project Sdk="Azure.Functions.Sdk"> | |||
There was a problem hiding this comment.
Explanation for reviewers
Microsoft.NET.Sdk.Web is Microsoft.NET.Sdk plus ASP.NET defaults. Azure.Functions.Sdk works the same way. Its Sdk.props and Sdk.targets start by importing Microsoft.NET.Sdk.Worker, which builds on Microsoft.NET.Sdk:
Azure.Functions.Sdk → Microsoft.NET.Sdk.Worker → Microsoft.NET.Sdk
l
So everything we had before is still here, with a Functions layer on top:
OutputTypeandAzureFunctionsVersionare defaults now, set by the Worker SDK and the Functions SDK. That's why these have been deleted from the project.- It adds the Functions build steps: generating function metadata, writing
worker.config.jsonandextensions.json, wiringdotnet runto start the Functions host, and publishing to Azure.
Package reference vs SDK
The old setup did roughly the same work, but delivered it as an ordinary package, Microsoft.Azure.Functions.Worker.Sdk:
PackageReference (old) |
Sdk attribute (new) |
|
|---|---|---|
| When its logic loads | After restore. NuGet generates obj/*.nuget.g.props/.targets, and the next evaluation imports the package's build/ files from there |
Before anything else, when MSBuild first evaluates the project |
| Can it change restore itself? | No. Restore has already happened by the time it loads | Yes. It hooks Restore to generate and restore azure_functions.g.csproj |
| Can it supply defaults you override? | Not cleanly. Its .props come in through NuGet's import, so you had to set properties yourself |
Yes. Sdk.props runs before your body, the same way Microsoft.NET.Sdk does |
| Versioning | Ordinary NuGet resolution | Attribute or global.json, and never pulled in transitively |
| "allowPrerelease": false | ||
| }, | ||
| "msbuild-sdks": { | ||
| "Azure.Functions.Sdk": "1.0.1" |
There was a problem hiding this comment.
A bit annoying that we have to include this in the global.json file, for a single sample project, but there doesn't seem to be a way around that.
<Project Sdk="Azure.Functions.Sdk"> creates an extension project as an intermediate artefact of the build process, which has no version... Without this in global.json NuGet fails with MSB4236. Because it's done via an SDK reference, there's no way to do this as a build property :-(
msbuild-sdks in global.json is where the resolver looks when a project gives no version, so pinning it here covers both the sample project and the intermediate extension project.
There's a suggestion to fix this upstream:
There was a problem hiding this comment.
Got it, but fair.
I've added a comment, maybe we just mention this on the code as well.
There was a problem hiding this comment.
Covered by the comment now at the top of the sample project (db0e2b9), which is where someone copying the sample will look. global.json itself stays comment-free.
🤖 Addressed by Claude Code
…rsion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The macOS leg of build.yml built Sentry.Maui.Device.TestApp for net9.0-android, net10.0-android and net10.0-ios, and nothing in build.yml runs it. In the run for #5752 on version7 that was the last 6 minutes of the 24.7-minute Build step, on the critical path. The Linux and Windows filters already exclude the app, and both device test workflows build it themselves. The macOS leg of verify-api builds the same filter, so it no longer builds the app either. The device test path filters now also cover what the app compiles and they didn't list: Sentry.Analyzers, Sentry.Testing.CrashableApp, the nested Directory.Build files and .editorconfig, which can fail the build because warnings are errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verify-api and format-code (#5758) * ci: stop building the device test app in the macOS build job The macOS leg of build.yml built Sentry.Maui.Device.TestApp for net9.0-android, net10.0-android and net10.0-ios, and nothing in build.yml runs it. In the run for #5752 on version7 that was the last 6 minutes of the 24.7-minute Build step, on the critical path. The Linux and Windows filters already exclude the app, and both device test workflows build it themselves. The macOS leg of verify-api builds the same filter, so it no longer builds the app either. The device test path filters now also cover what the app compiles and they didn't list: Sentry.Analyzers, Sentry.Testing.CrashableApp, the nested Directory.Build files and .editorconfig, which can fail the build because warnings are errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: serialize only the jobs that push in verify-api and format-code Both workflows put the whole run in the pr-auto-commit concurrency group, so each waited for the other to finish. On one PR, format-code started 35 minutes after its run was created, and on another verify-api waited 13 minutes. The group exists to keep their git pushes apart, so it now covers only accept-api-changes and the format-code job, and the API test matrix starts right away. Both still push from the head they checked out and fail as non-fast-forward if the branch moved in the meantime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Moves
Sentry.Samples.OpenTelemetry.AzureFunctions, the last sample still onnet10.0, tonet11.0.Microsoft.Azure.Functions.Worker.Sdkwill not get .NET 11 support. Its 2.1.0 targets warn that .NET 11 needs the newAzure.Functions.SdkMSBuild SDK, which reached 1.0 in September. This follows that package's migration guide:Sdk="Azure.Functions.Sdk", drop theWorker.Sdkreference,OutputTypeandAzureFunctionsVersion.Microsoft.Azure.Functions.Workergoes to 2.52.0, the version the guide expects.Why the SDK version is in
global.jsonThe SDK version is pinned under
msbuild-sdksinglobal.jsonrather than in theSdkattribute. During restore the SDK generatesobj/azure_functions/azure_functions.g.csprojwith a version-less<Project Sdk="Azure.Functions.Sdk">, expecting it to reuse the outer project's resolution. WithSdk="Azure.Functions.Sdk/1.0.1"that works for a single-node build orrestore+build --no-restore. A default multi-nodedotnet buildfails inGetFunctionsExtensionFileswithMSB4236: The SDK 'Azure.Functions.Sdk' specified could not be found.msbuild-sdksis where the NuGet SDK resolver looks for a version when the project gives none. Related upstream: Azure/azure-functions-dotnet-worker#3506.Not a user-facing change. #skip-changelog
Closes #5548
🤖 Generated with Claude Code