如何 gitignore 在 Visual Studio 2015 中编译时生成的文件

How to gitignore the files that get generated when you compile in Visual Stuido 2015

我目前正在使用 GitHub 中的 .gitignore 文件,但每次我在 Visual Studio 中编译我的项目时,都会生成一堆文件。

这些是我每次编译时生成的文件。

MyApp/bin/Debug/MyApp.exe

MyApp/bin/Debug/MyApp.exe.CodeAnalysisLog.xml

MyApp/bin/Debug/MyApp.pdb

MyApp/obj/Debug/Views/MyApp.exe

MyApp/obj/Debug/MyApp.g.resources

MyApp/obj/Debug/MyApp.pdb

MyApp/obj/Debug/Views/ReportsView.baml

MyApp/obj/Debug/Views/ReportsView.g.cs

MyApp/obj/Debug/Views/ReportsView.g.i.cs

这是正常现象吗? 有没有办法将这些文件包含在我的 .gitignore 文件中,以便在 Git 中提交更改时忽略它们?

将这 2 个条目添加到 the .gitignore file 以在构建期间忽略生成的文件(obj 和 bin 目录)

[Oo]bj/
[Bb]in/

现在它们未显示为已修改。