Skip to content

Normalizing .njsproj files #2352

Open
Open

Description

I use a NodeJs project (.njsproj) in VS2022 for a React-based SPA. Committing code in this project is difficult because of seemingly insignificant changes in the .njsproj file:

  1. Some .js files are marked <Compile>, others are <Content>. JSX files are similarly split.
  2. CSS files (.css) are usually marked <Content>. But it's unclear why, as they're usually compiled by webpack too.
  3. Some random <Compile> and <Content> entries have <SubType>Code</SubType> but others don't.
  4. Some entries are sorted, other newly created entries are are placed randomly.

My project was created in an earlier version of VS (VS2015 I think) and upgraded over time, but even a new project created in VS2022 has the third issue. This is what a new NodeJs project looks like (with a .jsx and .css file created):

  <ItemGroup>
    <Content Include="app.js" />
    <Content Include="JavaScript1.jsx">
      <SubType>Code</SubType>
    </Content>
    <Content Include="package.json" />
    <Content Include="README.md" />
    <Content Include="StyleSheet1.css">
      <SubType>Code</SubType>
    </Content>
  </ItemGroup>

Could we have the tooling normalize these files when a project is opened?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions