Install
dotnet add package Meziantou.Framework.TemporaryDirectory --version 3.0.16
| Product | Versions |
|---|---|
| .NET |
README
Meziantou.Framework.TemporaryDirectory
TemporaryDirectory
Create a unique empty folder that is deleted at the end of the scope.
using var temporaryDirectory = TemporaryDirectory.Create();
temporaryDirectory.CreateEmptyFile("test/demo.txt");
File.WriteAllText(temporaryDirectory.GetFullPath("foo.txt"), "bar");
TemporaryFile
Create a unique file that is deleted at the end of the scope.
// Generated name under the system temp folder
using var temporaryFile = TemporaryFile.Create();
File.WriteAllText(temporaryFile.FullPath, "content");
// Choose the file name; a unique parent folder is created for it
using var namedFile = TemporaryFile.Create("custom.txt");
// Choose the full path. The file must not already exist.
using var atPath = TemporaryFile.Create(FullPath.Combine(Path.GetTempPath(), $"custom-{Guid.NewGuid():N}.txt"));
Changes from Previous Version
No structural changes between v3.0.15 and v3.0.16.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.