dotnet / dotnet/aspnetcore

Ability to use route pattern analyzer in non-web projects

Open
#52,532 2 comments 3 reactions 0 assignees View on GitHub
analyzer area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

When working on a web project that involves a separate shared project which contains route definitions (e.g. with a class named ApiRoutes), the current syntax highlighting support is limited to the web project.

The absence of route syntax highlighting in the shared project makes the development experience worse and challenging to have a consistent setup across projects.

### Describe the solution you'd like

To address this issue effectively, it would be beneficial to provide developers with the option to choose whether they want to enable syntax highlighting for route definitions in shared projects (for example through NuGet packages).
This flexibility ensures that developers can tailor their coding environment to best suit their preferences and workflow requirements.

Reference for route syntax highlighting:
https://github.com/dotnet/aspnetcore/tree/main/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage

### Additional context
**Current workaround:**
To get syntax highlighting for routes in non web projects you can add ```` to your ``.csproj`` file.

Sample:
```xml


net8.0
enable
enable



```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.