-
Notifications
You must be signed in to change notification settings - Fork 201
[MSBUILD SDK] Restore inner project as part of outer restore #3265
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
base: feature/msbuild-sdk
Are you sure you want to change the base?
Conversation
| This target is a safeguard to ensure that the target framework is not overridden by a global property. | ||
| This projects TFM is intended to match the Azure Functions Host TFM, and NOT the TFM of the csproj which generated this file. | ||
| --> | ||
| <Target Name="_VerifyTargetFramework" BeforeTargets="Restore;Build"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a test for this, but I don't know how to actually get this condition to be true. This is essentially a failsafe incase all other preventions for setting TFM here are circumvented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automatic restoration of the generated inner extension project (azure_functions.g.csproj) as part of the outer restore process. It introduces "Inner" targets that allow the generated project to use the same Azure.Functions.Sdk instead of Microsoft.NET.Sdk.Functions, achieved by pivoting the SDK's import graph based on project name detection.
Key Changes:
- New
RestoreExtensionProjecttarget invokes restore on the generated extension project during outer restore - Inner targets/props enable the generated project to use
Azure.Functions.Sdkwith isolated build logic - Test validation now confirms the generated project is properly restored by checking for
project.assets.json
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
SdkEndToEndTests.Restore.cs |
Adds validation for generated project restoration and refactors validation logic |
MSBuildLogExtensions.cs |
Refactors extension method to old-style syntax to avoid Roslyn analyzer warning |
Azure.Functions.Sdk.Inner.targets |
New targets for inner project build with TFM verification safeguard |
Azure.Functions.Sdk.Inner.props |
New props for inner project with isolated Directory.Build imports and net8.0 TFM |
Azure.Functions.Sdk.Extensions.targets |
Adds RestoreExtensionProject target and property name corrections |
Azure.Functions.Sdk.Extensions.props |
Converts public properties to private and adds _AzureFunctionsExtensionRemoveProps |
Sdk.targets |
Conditional import of inner vs outer targets based on _IsExtensionProject |
Sdk.props |
Detects extension project by name and conditionally imports inner vs outer props |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Issue describing the changes in this PR
resolves #3133
Pull request checklist
release_notes.mdAdditional information
This PR adds a target to invoke
restoreon the generated project as part of outer restore. This PR also adds the first set of "Inner" targets. Instead of the generated project using theMicrosoft.NET.Sdk.Functions, it will also useAzure.Functions.Sdk(in fact, the exact same copy on disk the outer project uses). This is done by pivoting the SDK's import graph when we detect the project isazure_functions.g.csproj