1

I have a database project in my .net solution. Whenever I am building/rebuilding the solution '.sqlprojAssemblyReference.cache' file is generated in database project's obj/Debug folder.

I have in my git ignore obj directories and cache files ignored but still it is not working as expected.

    # Build results
    [Dd]ebug/
    [Oo]bj/

    # Visual Studio cache files
    # files ending in .cache can be ignored
    *.[Cc]ache
    # but keep track of directories ending in .cache
    !?*.[Cc]ache/

I am expecting this file not to appear in my changes as I added this in .gitignore as similar to packages folder for which I added a format earlier in .gitignore. In both the cases I had not made any commit.

Ashish Dehariya
  • 216
  • 3
  • 10

1 Answers1

0

This is expected behavior - the build process will generate this file.

The .gitignore file only tells Git / Visual Studio that this file/directory is not to be added to source control.

If you have already have this file in source control - e.g. it was checked in before you added the .gitignore file -, you may need to forcibly remove the file from git using:

git rm -r --cached path\to\obj

or see How to make Git "forget" about a file that was tracked but is now in .gitignore?

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
  • 1
    Yes I understand that it will be generated as its expected behavior, but could you please let me know why it is shown as my changes after adding it in gitignore. I had another file as well that stopped appearing in my changes after adding it in gitignore. I had not made any commit though. – Ashish Dehariya Aug 13 '19 at 14:53