Skip to content

Add *.lscache to VisualStudio.gitignore#4839

Open
wherewhere wants to merge 1 commit into
github:mainfrom
wherewhere:lscache
Open

Add *.lscache to VisualStudio.gitignore#4839
wherewhere wants to merge 1 commit into
github:mainfrom
wherewhere:lscache

Conversation

@wherewhere
Copy link
Copy Markdown

Reasons for making this change

The C# Dev Kit create *.csproj.lscache in new version.

Links to documentation supporting these rule changes

Said by *.csproj.lscache

# This file caches language service data to improve the performance of C# Dev Kit.
# It is not intended for manual editing. It can safely be deleted and will be
# regenerated automatically.
#
# To exclude from version control, add *.lscache to your .gitignore file.

Merge and Approval Steps

  • Confirm that you've read the contribution guidelines and ensured your PR aligns
  • Ensure CI is passing
  • Get a review and Approval from one of the maintainers

@wherewhere wherewhere requested a review from a team as a code owner April 7, 2026 08:34
Copilot AI review requested due to automatic review settings April 7, 2026 08:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new ignore pattern to the repository’s Visual Studio-focused .gitignore rules to prevent C# Dev Kit’s language service cache files (*.csproj.lscache) from being committed.

Changes:

  • Add *.lscache ignore entry for VS Code C# Dev Kit cache artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread VisualStudio.gitignore
*.msp

# VS Code C# Dev Kit
*.lscache
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd ask that this line is commented out by default and an explanation for why you'd want them ignored included, based on this issue by @JakeRadMSFT: microsoft/vscode-dotnettools#2961

From the issue:

What if I don't want them in source control?
We'd encourage you to try checking them in and experience the benefits, but we understand not every team will want that. You can add .lscache to your .gitignore if you prefer. You'll still get the per-machine caching benefits (warm starts when reopening the same project), you just won't get the cross-machine and branch-switching benefits. We're exploring configuration options to give users more control here.

@dooleydevin
Copy link
Copy Markdown
Collaborator

I'm open to discussion on this one, but I do think we shouldn't ignore any files by default that the maintainers of the tooling intend to be included in source control.

@wherewhere
Copy link
Copy Markdown
Author

This file contains a lot of local things such as /platform:x64 or <DOTNET>/sdk/10.0.300-preview.0.26177.108/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig. It maybe changed every time when open the project on different devices. It should be treated like *.csproj.user which is related to local environments.

@Thaina
Copy link
Copy Markdown

Thaina commented May 15, 2026

@dooleydevin This was officially ignored dotnet/sdk#53752

@wherewhere
Copy link
Copy Markdown
Author

Ignore it!

@aydenhailey78-hub
Copy link
Copy Markdown

aydenhailey78-hub commented May 15, 2026 via email

@twubndgsijlc-netizen
Copy link
Copy Markdown

twubndgsijlc-netizen commented May 15, 2026 via email

@aydenhailey78-hub
Copy link
Copy Markdown

aydenhailey78-hub commented May 15, 2026 via email

Copy link
Copy Markdown

@CyberNFT CyberNFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..

@CyberNFT
Copy link
Copy Markdown

Reasons for making this change

The C# Dev Kit create *.csproj.lscache in new version.

Links to documentation supporting these rule changes

Said by *.csproj.lscache

# This file caches language service data to improve the performance of C# Dev Kit.
# It is not intended for manual editing. It can safely be deleted and will be
# regenerated automatically.
#
# To exclude from version control, add *.lscache to your .gitignore file.

Merge and Approval Steps

  • Confirm that you've read the contribution guidelines and ensured your PR aligns
  • Ensure CI is passing
  • Get a review and Approval from one of the maintainers

Don't work

@dooleydevin
Copy link
Copy Markdown
Collaborator

Hey folks, I still think the point I made in #4839 (comment) is valid, and this shouldn't be ignored by default.

Per our contribution guidelines, we don't ignore anything that developers may reasonably want to include in their source control. Even if many developers do prefer to ignore it, these templates get used by a lot of teams and should attempt to be compatible with all intended workflows.

Like I said in my review, an owner of the project specifically said they encourage it to be checked into source control, so ignoring this by default would go against our guidelines:

What if I don't want them in source control?

We'd encourage you to try checking them in and experience the benefits, but we understand not every team will want that. You can add .lscache to your .gitignore if you prefer. You'll still get the per-machine caching benefits (warm starts when reopening the same project), you just won't get the cross-machine and branch-switching benefits. We're exploring configuration options to give users more control here.

It looks like this is starting to get a lot of attention because of an accidental change to how these are generated by default. I'd suggest that everyone impacted who does not want these committed add it to the .gitignore files they use, and @wherewhere can update the template to include a commented version of this and a descriptor of why someone might ignore it.

This is the same approach that we've taken elsewhere in this repository. I believe this section of the Python.gitignore file is one of the better examples: https://github.com/github/gitignore/blob/main/Python.gitignore#L86

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants