gitignore icon indicating copy to clipboard operation
gitignore copied to clipboard

Add *.lscache to VisualStudio.gitignore

Open wherewhere opened this issue 7 months ago • 12 comments

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

  • [x] 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 avatar Apr 07 '26 08:04 wherewhere

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.

dooleydevin avatar Apr 17 '26 23:04 dooleydevin

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.

wherewhere avatar Apr 18 '26 05:04 wherewhere

@dooleydevin This was officially ignored https://github.com/dotnet/sdk/pull/53752

Thaina avatar May 15 '26 06:05 Thaina

Ignore it!

wherewhere avatar May 15 '26 11:05 wherewhere

ok will respond later

On Fri, May 15, 2026 at 11:09 AM where where @.***> wrote:

wherewhere left a comment (github/gitignore#4839) https://github.com/github/gitignore/pull/4839#issuecomment-4459204703

Ignore it!

— Reply to this email directly, view it on GitHub https://github.com/github/gitignore/pull/4839#issuecomment-4459204703, or unsubscribe https://github.com/notifications/unsubscribe-auth/B4CX3QAMOX67PQBBP72MZ3T4233FBAVCNFSM6AAAAACXPEUVKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINJZGIYDINZQGM . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

aydenhailey78-hub avatar May 15 '26 15:05 aydenhailey78-hub

received appreciate it

On Fri, May 15, 2026 at 11:09 AM where where @.***> wrote:

wherewhere left a comment (github/gitignore#4839) https://github.com/github/gitignore/pull/4839#issuecomment-4459204703

Ignore it!

— Reply to this email directly, view it on GitHub https://github.com/github/gitignore/pull/4839#issuecomment-4459204703, or unsubscribe https://github.com/notifications/unsubscribe-auth/B4CX3ZZLMHRA3CNFVWGU5X34233FBAVCNFSM6AAAAACXPEUVKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINJZGIYDINZQGM . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

twubndgsijlc-netizen avatar May 15 '26 15:05 twubndgsijlc-netizen

got the message thanks

On Fri, May 15, 2026 at 3:05 PM twubndgsijlc-netizen < @.***> wrote:

twubndgsijlc-netizen left a comment (github/gitignore#4839) https://github.com/github/gitignore/pull/4839#issuecomment-4460910927 received appreciate it

On Fri, May 15, 2026 at 11:09 AM where where @.***> wrote:

wherewhere left a comment (github/gitignore#4839) https://github.com/github/gitignore/pull/4839#issuecomment-4459204703

Ignore it!

— Reply to this email directly, view it on GitHub https://github.com/github/gitignore/pull/4839#issuecomment-4459204703,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/B4CX3ZZLMHRA3CNFVWGU5X34233FBAVCNFSM6AAAAACXPEUVKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINJZGIYDINZQGM>

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>

or Android < https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/github/gitignore/pull/4839#issuecomment-4460910927, or unsubscribe https://github.com/notifications/unsubscribe-auth/B4CX3QDTZC334LJXRMTX34D424W2HAVCNFSM6AAAAACXPEUVKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DINRQHEYTAOJSG4 . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

aydenhailey78-hub avatar May 15 '26 15:05 aydenhailey78-hub

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

  • [x] 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

CyberNFT avatar May 15 '26 20:05 CyberNFT

Hey folks, I still think the point I made in https://github.com/github/gitignore/pull/4839#discussion_r3103741566 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

dooleydevin avatar May 15 '26 20:05 dooleydevin

Bad, I will add comment :(

wherewhere avatar May 16 '26 04:05 wherewhere

Same here. These files add no value in VCS, cause everyone on our team has different setups

Sample of an .lscache file produced on my system (Linux nixos 6.12.87)

[analyzerReferences]
../../../../../../../nix/store/0r8iidkhy8ky5nak95nsl3x05i33qbdb-dotnet-combined/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/8.0.26/analyzers/dotnet/cs/
 Microsoft.AspNetCore.App.Analyzers.dll
 Microsoft.AspNetCore.App.CodeFixes.dll
 Microsoft.AspNetCore.Components.Analyzers.dll
../../../../../../../nix/store/0r8iidkhy8ky5nak95nsl3x05i33qbdb-dotnet-combined/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/8.0.26/analyzers/dotnet/roslyn4.4/cs/
 Microsoft.Extensions.Logging.Generators.dll
 Microsoft.Extensions.Options.SourceGeneration.dll
../../../../../../../nix/store/0r8iidkhy8ky5nak95nsl3x05i33qbdb-dotnet-combined/share/dotnet/packs/Microsoft.NETCore.App.Ref/8.0.26/analyzers/dotnet/cs/
 Microsoft.Interop.ComInterfaceGenerator.dll
 Microsoft.Interop.JavaScript.JSImportGenerator.dll
 Microsoft.Interop.LibraryImportGenerator.dll
 Microsoft.Interop.SourceGeneration.dll
 System.Text.Json.SourceGeneration.dll
 System.Text.RegularExpressions.Generator.dll
../../../../../../../nix/store/0r8iidkhy8ky5nak95nsl3x05i33qbdb-dotnet-combined/share/dotnet/sdk/8.0.420/Sdks/Microsoft.NET.Sdk/analyzers/
 Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll
 Microsoft.CodeAnalysis.NetAnalyzers.dll
<NUGET>/awssdk.apigateway/3.7.300.71/analyzers/dotnet/cs/
 AWSSDK.APIGateway.CodeAnalysis.dll
 SharedAnalysisCode.dll
<NUGET>/microsoft.codeanalysis.analyzers/3.3.3/analyzers/dotnet/cs/
 Microsoft.CodeAnalysis.Analyzers.dll
 Microsoft.CodeAnalysis.CSharp.Analyzers.dll
<NUGET>/microsoft.entityframeworkcore.analyzers/8.0.2/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll

[analyzerConfigFiles]
../../../../../../../nix/store/0r8iidkhy8ky5nak95nsl3x05i33qbdb-dotnet-combined/share/dotnet/sdk/8.0.420/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_8_default.globalconfig
obj/Debug/net8.0/Workflow.GeneratedMSBuildEditorConfig.editorconfig

Those ../nix/store/ paths won't exist unless the system is built from the same configuration with same packages versions

tiger31 avatar May 18 '26 13:05 tiger31

Another issue for moving it to $HOME/.cache https://github.com/microsoft/vscode-dotnettools/issues/2952

Frulfump avatar Jun 10 '26 19:06 Frulfump