Skip to content

Conversation

@jviau
Copy link
Contributor

@jviau jviau commented Nov 20, 2025

Issue describing the changes in this PR

resolves #3133

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

Additional information

This PR adds a target to invoke restore on the generated project as part of outer restore. This PR also adds the first set of "Inner" targets. Instead of the generated project using the Microsoft.NET.Sdk.Functions, it will also use Azure.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 is azure_functions.g.csproj

Copilot AI review requested due to automatic review settings November 20, 2025 23:27
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">
Copy link
Contributor Author

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.

Copilot finished reviewing on behalf of jviau November 20, 2025 23:29
Copy link

Copilot AI left a 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 RestoreExtensionProject target invokes restore on the generated extension project during outer restore
  • Inner targets/props enable the generated project to use Azure.Functions.Sdk with 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants