azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

Delegate parsing of targetFramework to dotnet CLI

Open gukoff opened this issue 1 year ago • 0 comments

Issue describing the changes in this PR

Instead of parsing the .csproj file, determine the target framework by calling dotnet build -getproperty:TargetFramework.

It "works on my machine" (OSX, dotnet 8.0.201). I'm not aware if this solution has portability issues.

resolves #3565

Alternatives considered

I tried using new Project(path) instead of ProjectRootElement.Open(path) in hopes that new Project would find and import any external properties.

It didn't run. My .csproj file starts with <Project Sdk="Microsoft.NET.Sdk">, and calling new Project(csproj_content) throws exception The SDK 'Microsoft.NET.Sdk' specified could not be found.

Pull request checklist

  • [x] My changes do not require documentation changes
    • [ ] Otherwise: Documentation issue linked to PR
  • [?] 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)

gukoff avatar Feb 21 '24 11:02 gukoff