dotnet / dotnet/msbuild

Stop using the default temp directory and temp file paths

Open
#6,219 9 comments 4 reactions 0 assignees View on GitHub
needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Using Path.GetTempPath() and GetTempFileName() is an anti-pattern. We currently use paths like these:
`C:\Users\VssAdministrator\AppData\Local\Temp\ntg31ahj.fhf\tmp71A.tmp` and the problem is the default algorithm only allows 65,536 temp files. If we overflow, we start failing to create a temp file. Users run into this periodically when their temp directory is full. These errors are usually hard to diagnose (why did this temp file failed to get created??)

It is considered a good practice to create a folder "MSBuild" under Temp, and only write everything under that folder, so that people know who owns these files. Ideally of course the OS would provide a dedicated isolated temp folder for each app.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.