github/gitignore · Dotnet.gitignore

.NET .gitignore 템플릿 해설

Dotnet.gitignore가 bin·obj, Debug·Release, NuGet 패키지, MSBuild 바이너리 로그, 테스트 결과, .env를 무시하는 이유와 VisualStudio 템플릿과의 차이를 설명합니다.

생성기에서 열기 VisualStudio, VisualStudioCode, JetBrains, Windows 함께 열기

Dotnet.gitignore는 .NET SDK 스타일 프로젝트(dotnet new로 만든 C#·F# 프로젝트)를 위한 간결한 템플릿이다. 템플릿 머리 주석이 밝히듯, Visual Studio를 쓴다면 IDE 관련 규칙이 훨씬 많은 VisualStudio 템플릿을 함께 쓰는 것이 좋다.

VS Code, Rider, 명령줄에서 개발한다면 이 템플릿만으로 빌드 결과와 도구 부산물을 대부분 막을 수 있다.

규칙별 해설

패턴무엇을, 왜 무시하나
[Bb]in/[Oo]bj/[Dd]ebug/[Rr]elease/x64/x86/bld/빌드 출력dotnet build가 만드는 어셈블리와 중간 파일(obj/project.assets.json 등)이다. 브래킷으로 Bin·bin 같은 대소문자 차이를 모두 잡는다.
artifacts/project.lock.jsonproject.fragment.lock.json.NET 산출물artifacts/는 .NET 8부터 쓸 수 있는 통합 출력 레이아웃 폴더이고, project.lock.json은 옛 project.json 시절의 복원 결과다.
*.nupkg*.snupkgNuGet 패키지dotnet pack으로 만든 패키지와 심볼 패키지다. NuGet 피드에 게시하는 산출물이다.
*.binlog[Tt]est[Rr]esult*/[Bb]uild[Ll]og.*TestResult.xmlnunit-*.xmlCodeCoverage/로그·테스트 결과MSBuild 바이너리 로그(-bl 옵션), 테스트·커버리지 결과다. 바이너리 로그에는 환경 변수 등 민감한 값이 담길 수 있어 공유에 주의한다.
.env~$**~환경·임시 파일환경 변수 파일, Office 문서를 열 때 생기는 잠금 파일(~$문서.docx), 에디터 백업 파일이다.

실무에서 주의할 점

원본 템플릿

Dotnet.gitignore규칙 30줄
## A streamlined .gitignore for modern .NET projects## including temporary files, build results, and## files generated by popular .NET tools. If you are## developing with Visual Studio, the VS .gitignore## https://github.com/github/gitignore/blob/main/VisualStudio.gitignore## has more thorough IDE-specific entries.#### Get latest from https://github.com/github/gitignore/blob/main/Dotnet.gitignore# Build results[Dd]ebug/[Dd]ebugPublic/[Rr]elease/[Rr]eleases/x64/x86/[Ww][Ii][Nn]32/[Aa][Rr][Mm]/[Aa][Rr][Mm]64/bld/[Bb]in/[Oo]bj/[Ll]og/[Ll]ogs/# .NET Coreproject.lock.jsonproject.fragment.lock.jsonartifacts/# ASP.NET ScaffoldingScaffoldingReadMe.txt# NuGet Packages*.nupkg# NuGet Symbol Packages*.snupkg# dotenv environment variables file.env# Others~$**~CodeCoverage/# MSBuild Binary and Structured Log*.binlog# MSTest test Results[Tt]est[Rr]esult*/[Bb]uild[Ll]og.*# NUnit*.VisualState.xmlTestResult.xmlnunit-*.xml

템플릿 출처: github/gitignore/Dotnet.gitignore @356fd7b (2026-09-11) · CC0-1.0

함께 쓰는 템플릿

다른 템플릿 해설