Skip to content

Replace - with _ when generating namespace for generated types#2097

Merged
kshyju merged 7 commits intomainfrom
shkr/get_srcgen_namespace
Nov 28, 2023
Merged

Replace - with _ when generating namespace for generated types#2097
kshyju merged 7 commits intomainfrom
shkr/get_srcgen_namespace

Conversation

@kshyju
Copy link
Copy Markdown
Member

@kshyju kshyju commented Nov 27, 2023

Today. when you create a new project_(any project type_) in Visual studio with - in the name(Ex: "FOO-BAR"), The tooling will add an explicit root namespace entry to the .cpsoj file.

<RootNamespace>FOO_BAR</RootNamespace>

But we have customers reporting their existing projects with "-" in it running into invalid namespace name issue for the generated types when they upgraded to recent versions of worker sdk.

  1. Microsoft.Azure.Functions.Worker.Sdk 1.15.0: issue with a RootNamespace containing a hyphen #1957
  2. FunctionMetadataProviderGenerator code fails to build if project name has dash in name #2076

The fix is to always use the FunctionsGeneratedCodeNamespace msbuild proerty value. If user has not provided it, we will set the RootNamespace msbuild property value as the value of FunctionsGeneratedCodeNamespace.

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)

@kshyju kshyju force-pushed the shkr/get_srcgen_namespace branch from 9253dd1 to f67f37f Compare November 27, 2023 20:20
@kshyju kshyju merged commit 1808ec7 into main Nov 28, 2023
@kshyju kshyju deleted the shkr/get_srcgen_namespace branch November 28, 2023 23:54
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.

3 participants