How to "unignore" Visual Studio Web Site *.refresh files when you have [Bb]in/*

3.7k views Asked by At

I'm using the standard Visual Studio .gitignore at https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

Part of that gitignore is to ignore the bin folders, but this is a problem, because I need to include bin/*.refresh files for visual studio web site projects.

When one has a (local file) web site project in: C:\Projects\MyprojectA\MyProjectWeb then any references to libraries are stored as "hint files" in the C:\Projects\MyprojectA\MyprojectWeb\bin folder as *.refresh.

So if you reference (a non framework DLL) AjaxControlToolkit.dll, so in the bin folder, you end up with AjaxControlToolkit.dll and AjaxControlToolkit.dll.refresh. The content of the file indicates the path of where to find that DLL. (Let's ignore the potential pathing problems when the repo is cloned, because we're checking in the DLLs into a _lib folder that's also checked into the repo)

How does one "unignore" the *.refresh files found within Visual Studio Web Site project bin folders so that they are included with clones of the repo?

4

There are 4 answers

0
Nate Cook On BEST ANSWER

Use the exclamation mark.

**/[Bb]in/*
!**/[Bb]in/*.refresh
0
Carter Medlin On

Once folders are excluded they can't be un-excluded. Do it this way to include sub-folders like roslyn.

replace

[Bb]in/

with

**/[Bb]in/**/*.*
!**/[Bb]in/**/*.refresh
0
Alex Yena On

How about using this VS feature?:

VS screenshot

0
ViktorvX On

Tiny expansion to Alex' answer, the 'Add Ignored File' button might be hidden under the 'Git' submenu.

'Add Ignored File to Source Control' button