Skip to content

Buildcheck template - grace handle names/dirs starting with numbers #10606

Open
@JanKrivanek

Description

@JanKrivanek

Context

If msbuildcheck template is being instantiated with name (or implicit name derived from the current dir name) that starts with number - the include item fro the 'magic' props is broken

Repro steps

  • dotnet new msbuildcheck -n 123
  • The created csproj will contain broken include (the name _123.props doesn't correspond with the filename - 123.props):
  <ItemGroup>
    <None Include="_123.props" Pack="true" PackagePath="build\_123.props" />
    <Content Include="README.md" />
  </ItemGroup>

Analysis

This has to do with templating feature that is trying to make the names a valid C# token names - so numbers are auto-prefixed with '_'. We need to make sure that the include link is not expanded like this, or that the props file name is generated that way

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions