Skip to content

Conversation

@psryland
Copy link
Contributor

@psryland psryland commented Oct 30, 2025

Added a new command-line option "--cache-path" (or "-p") to allow users to specify the temporary directory used to build the script. This is equivalent to the 'DOTNET_SCRIPT_CACHE_LOCATION' environment variable but is far more convenient when scripts are run as part of MSBuild. In particular, parallel runs of a script can specify different cache paths preventing the "script.csproj is in use" error that can happen. (Re: issues #507, #596, #540)

For example,

    <Exec
      Command="dotnet-script --cache-path $(OutDir) PostBuildStep.csx -- $(TargetPath)"
      WorkingDirectory="$(ProjectDir)"
    />

Added a new command-line option "--cache-path" (or "-p") to allow users to specify the temporary directory used to build the script. This is equivalent to the 'DOTNET_SCRIPT_CACHE_LOCATION' environment but is far more convenient when scripts are run as part of MSBuild.  In particular, parallel runs of a script can specify different cache paths preventing the "script.csproj is in use" failure that can happen. (Re: issues dotnet-script#507, dotnet-script#596, dotnet-script#540)
@psryland psryland marked this pull request as draft November 6, 2025 01:25
@psryland psryland marked this pull request as ready for review November 6, 2025 04:06
Assert.False(thirdResultOfScriptB.Cached);
}

[Fact]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you additionally update these tests so that all of them are executed for both default cache path and custom path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, will do.

@filipw
Copy link
Member

filipw commented Nov 6, 2025

Thanks a lot for the PR! I think this is a very welcome addition 😄

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.</Description>
<VersionPrefix>1.6.0</VersionPrefix>
Copy link
Member

@filipw filipw Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you rev all of these up to 1.7.0?

@filipw
Copy link
Member

filipw commented Nov 7, 2025

The linux test failures are unrelated to your PR. They will be resolved once we merge #779

@psryland
Copy link
Contributor Author

psryland commented Nov 7, 2025

The linux test failures are unrelated to your PR. They will be resolved once we merge #779

Ah, I was wondering about these errors. Good to know, thanks

@filipw filipw merged commit 6422290 into dotnet-script:master Nov 12, 2025
3 checks passed
@filipw
Copy link
Member

filipw commented Nov 12, 2025

thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants