标签云

微信群

扫码加入我们

WeChat QR Code

Which files should I include in .gitignore when using Git in conjunction with Visual Studio Solutions (.sln) and Projects?


Related question: stackoverflow.com/questions/72298/…

2019年11月22日39分40秒

I made this into a community wiki, and have consolidated all existing answers into the post. Please contribute as you see fit!

2019年11月22日39分40秒

I would be careful ignoring .exe and .pdb's, you may inadvertently ignore tooling that you store with your source (nant, nunit gui, etc...).

2019年11月22日39分40秒

murki - looks like this is the answer: coderjournal.com/2011/12/…

2019年11月22日39分40秒

With .sln files checked in, we get noise diffs such as -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0Can this be avoided?

2019年11月22日39分40秒

Please note. This file contains an entry to ignore published files. However the way the rule is written, it will ignore Any folder you have called "Publish", and will there fore ignore anything you have under neath it. It does not specifically target the Visual Studio "Publishing" output. It will ignore it, but also other things.

2019年11月22日39分40秒

starfighterxyz if you think there is a bug in the gitignore, I would recommend creating a pull request.

2019年11月23日39分40秒

Well, I dont know (enough?) to say its a bug. I just happend to be using Publish/ as a Controller name, and as Project Folder names. I think this is just an edge case. Just something to save a few hours of your life :)

2019年11月22日39分40秒

Learner because these are in different files. You should add these to your personal global gitignore, instead of checking them in. github.com/github/gitignore/tree/master/Global

2019年11月23日39分40秒

ErikAronesty you can create an issue or a PR on the github repo. But *.user is already ignored, which includes .vcxproj.user.

2019年11月22日39分40秒

This is gem thanks so much

2019年11月23日39分40秒

Ideally, it would include a license inside the file. (Ideally, that would be a license that raises no questions in a corporate environment.)

2019年11月22日39分40秒

Also, this should have .vs/, see here: stackoverflow.com/a/31879242/1143274

2019年11月22日39分40秒

Disagree with *.resharper. Files matching *.ReSharper.user should be ignored, but that's catered for by the *.user rule above.

2019年11月22日39分40秒

DrewNoakes: What are the ReSharper files that you believe should be revision controlled?

2019年11月23日39分40秒

PerLundberg One reason worth considering is you can configure standard project formatting options, etc, and save the config files with the project. If this is in git, it makes it easier for everyone using Resharper to keep the project formatted consistently.

2019年11月22日39分40秒

DrewNoakes- Any suggestions for this please?

2019年11月23日39分40秒

anyone care to elaborate on why you'd want to exclude the packages folder? doesn't it make sense to include the packages for the build server to have the dependencies?

2019年11月22日39分40秒

It's worth noting that the NuGet team implemented the 'package restore' feature for exactly this problem. There's a document on the NuGet site which explains the feature and describes how to use it in Visual Studio.

2019年11月22日39分40秒

If you ignore packages and are using nuget package restore, it's helpful to allow nuget.exe. When someone downloads, this tells helps VS tell that the feature has been enabled for the solution: !NuGet.exe <- do not ignore this file.

2019年11月23日39分40秒

For those of you using AppHarbor, it's worth noting that excluding the packages folder will cause your build to fail deployment :)

2019年11月22日39分40秒

Agree. Also, this goes for "debug". Add the trailing slash to this to avoid ignoring files with debug in the name.

2019年11月22日39分40秒

I loved this part: Backup & report files from converting an old project fileto a newer Visual Studio version. Backup files are not needed,because we have git ;-)

2019年11月22日39分40秒

I quote James Gregory's comment here: "I would be careful ignoring .exe and .pdb's, you may inadvertently ignore tooling that you store with your source (nant, nunit gui, etc...). – James Gregory May 21 '10 at 13:32"

2019年11月23日39分40秒

Disagree with *.resharper. Files matching *.ReSharper.user should be ignored, but that's catered for by the *.user rule above.

2019年11月22日39分40秒

Just a clarification - it's actually moving BACK to InstallShield, which existed previous to VisualStudio installer, at least as far back as 1998!

2019年11月23日39分40秒

See James Gregory's comment on another answer:"I would be careful ignoring .exe and .pdb's, you may inadvertently ignore tooling that you store with your source (nant, nunit gui, etc...). – James Gregory May 21 '10 at 13:32"

2019年11月22日39分40秒

JimRaden In general, it's best to avoid checking in binary tools into Git. Best practices are to only check in your source to Git; if you need binary tools, include a script for installing them or a submodule with just those tools.

2019年11月23日39分40秒

I didn't know that there was a negation flag in .gitignore.Helpful tip!

2019年11月22日39分40秒

Latest version does not need to explicitly unignore nuget.exe

2019年11月22日39分40秒

tofutim, the latest version of what? git itself?

2019年11月23日39分40秒

the community wiki above

2019年11月22日39分40秒

Actually, git matches patterns relative to subdirectories, too, unless you start them with "/", in which case they only match things in the same directory as the .gitignore file.

2019年11月23日39分40秒