Skip to main content

cache_dir

Function cache_dir 

Source
pub fn cache_dir(
    class_name: &str,
    csharp_source: &str,
    build_raw: &str,
    run_raw: &str,
    references: &[PathBuf],
    target_framework: &str,
) -> PathBuf
Expand description

Compute the deterministic cache-dir path used to store compiled C# assemblies.

The path is <base_cache_dir>/<class_name>_<hex_hash>/ where hex_hash is a 64-bit hash of:

  • csharp_source — the complete C# source text
  • expand_dotnet_args(build_raw) — shell-expanded build args
  • std::env::current_dir() — the process working directory at call time
  • run_raw — hashed as a raw string
  • references — the list of reference DLL paths
  • target_framework — the TFM moniker (e.g. "net8.0")
  • maximum mtime (nanoseconds since Unix epoch) of any C#/dotnet-related file (.cs, .dll, .nupkg, .zip) found under directories in references, or the mtime of individual files listed there; None is hashed when no such paths are present

The base directory is resolved by base_cache_dir.