Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MEAI chat web template with --aspire flag: Class name mismatch in AppHost Program.cs causes build error #6811

Closed
Assignees
ViveliDuCh
Labels
@ViveliDuCh

Description

@ViveliDuCh

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When usingdotnet new aichatweb --provider [azureopenai,openai,ollama,githubmodels] --aspire -o my.aichatweb.project, if the project name or a related template class contains a dot (e.g.some.name), the generator creates a normalized class name with underscores (some_name) in theProjects namespace. However, in the generatedProgram.cs within the AppHost project, the original (non-normalized) name (some.name) is used in:

varwebApp=builder.AddProject<Projects.some.name>("aichatweb-app");

This causes a build error becauseProjects.some.name does not exist, onlyProjects.some_name does. The issue appears with any of the providers and requires manual editing ofProgram.cs to use the normalized name. This should be handled automatically by the template or generator logic.

Expected Behavior

The generatedProgram.cs should use the normalized class name, e.g.Projects.some_name, to match the generated class and avoid build errors.

Steps To Reproduce

  1. Rundotnet new aichatweb --provider openai --aspire -o my.aichatweb.project
  2. Use a project name or template parameter that contains a dot (e.g.some.name)
  3. Configure the AI Model Provider
  4. Try to build the solution
  5. Observe the CS0234 build error referencing a missing type or namespace namesome.name in the namespace 'Projects'
  6. Manually change toProjects.some_name insome.name.AppHost/Program.cs to fix the build

Exceptions (if any)

Build error:error CS0234: The type or namespace name 'some' does not exist in the namespace 'Projects' (are you missing an assembly reference?)

.NET Version info

dotnet --info.NET SDK: Version:           9.0.304 Commit:            f12f5f689e Workload version:  9.0.300-manifests.75243b89 MSBuild version:   17.14.16+5d8159c5fRuntime Environment: OS Name:     Windows OS Version:  10.0.26100 OS Platform: Windows RID:         win-x64 Base Path:   C:\Program Files\dotnet\sdk\9.0.304\

Anything else?

  • .NET Aspire version: 9.4.0-preview.1.25378.8
  • The IDE: VS/VS Code
  • This issue occurs with all listed providers: azureopenai, openai, ollama, githubmodels
  • The issue is not reported in the issue tracker as of this writing.

Side note:

There is a related issue with template-generated class and namespace normalization when project or folder names contain characters not allowed in C# identifiers (such as#). While the code generator correctly normalizes these names (e.g., convertingon#ly toon_ly) for type and namespace declarations, it fails to apply the same normalization in all code references—such as those inWeb/Program.cs. This inconsistency causes build errors due to mismatched identifiers and requires manual intervention to resolve. For robust code generation, identifier normalization should be applied consistently across all generated files and references.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp