dotnet / dotnet/sdk

dotnet run: Allow overriding single‑file “runfile” cache location for sandbox/container/LLM scenarios

Open
#49,568 1 comment 0 reactions 0 assignees View on GitHub
Area-CLI Area-run-file untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Description

With the new single‑file “dotnet run app.cs” feature, the CLI auto‑generates a temp project under the user home
(XDG_DATA_HOME/DOTNET_CLI_HOME). In locked‑down or sandboxed workflows (e.g. LLM‑CLI, agent containers without home write), this write fails:
Unhandled exception: Access to the path '/home/…/.local/share/dotnet/runfile/…' is denied.

### Repro

```bash
# simple repro on Linux
echo 'Console.WriteLine("Hello World");' > app.cs
dotnet run app.cs
# Note: Obviously you will only see an error if "codex" or some other sandboxed LLM agent attempts to write that code.

### Current workaround

Setting DOTNET_CLI_HOME or XDG_DATA_HOME to a project‑local folder avoids the error, but also relocates all CLI data (NuGet cache, global tools, telemetry) into that directory.

### Proposal

Introduce an option/flag (e.g. --runfile-cache-dir) or an env‑var (e.g. DOTNET_RUNFILE_CACHE) so that only the single‑file run cache is redirected, leaving the rest of the CLI user data undisturbed.

### Environment

.NET SDK: 10.0.100-preview.5
OS: Ubuntu 22.04 (or equivalent)

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.