Skip to content

[Feature Request]: Make it easier for overriding ToolTask temp rsp location #9229

Closed
@hknielsen

Description

Summary

A recent issue for us that we stumbled on was a Task, inheriting from ToolTask that didnt handle Unicode chars.
The User Name contained Unitycode chars, and ToolTask puts command line args into a temp response file
https://github.com/dotnet/msbuild/blob/main/src/Utilities/ToolTask.cs#L564C61-L564C61

The issue was reported to the owners of the Task, but trying to find a way to unblock is quite hard.
The rsp path are set as: Path.Combine(Path.GetTempPath(), $"MSBuildTemp{Environment.UserName}");
GetTempPath can be overriden by changing the TMP/TEMP User env vars.
But UserName are no way to override AFAICT today.

Background and Motivation

As a consumer of a NuGet package, containing Task with such a problem, I would like to be able to not be stuck with this issue again, without being able to fix it myself.

Proposed Feature

Possible solutions on the top of my head:

  • Property on the base class to set the tmp location, so we could override the Target and send in the extra tmp location Task parameter.
  • Env var for $"MSBuildTemp{Environment.UserName}")

Edit:

  • Remove appended username on Windows
  • Change to use SecurityIdentifier

Alternative Designs

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions