Unity-Technologies/UnityCsReference · critical · DirectoryNotFoundException
Unity SDK nuget feed not found at {sdkNugetsPath}
Error message
Unity SDK nuget feed not found at {sdkNugetsPath} What it means
Thrown by GetUnitySdkVersion (UnityEditorMSBuildPropsTargetsGeneration.cs:236, DirectoryNotFoundException) when the directory at sdkNugetsPath does not exist. This directory is Unity's bundled local NuGet feed that hosts the Unity.Sdk.<version>.nupkg used to pin the SDK in the generated global.json. A missing feed means the editor install is incomplete or the path resolution pointed at the wrong location.
Source
Thrown at Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs:236
}
throw new NotSupportedException($"Unsupported OS platform {RuntimeInformation.OSDescription}");
}
private static string s_cachedUnitySdkVersion;
// Reads the version from Unity.Sdk.<version>.nupkg so global.json tracks CI's bumped value
// (in sdk/UnitySdksCommon.props) instead of a hardcoded literal.
private static string GetUnitySdkVersion(string sdkNugetsPath)
{
if (s_cachedUnitySdkVersion != null)
return s_cachedUnitySdkVersion;
const string prefix = "Unity.Sdk.";
const string suffix = ".nupkg";
if (!Directory.Exists(sdkNugetsPath))
throw new DirectoryNotFoundException($"Unity SDK nuget feed not found at {sdkNugetsPath}");
foreach (var file in Directory.EnumerateFiles(sdkNugetsPath, $"{prefix}*{suffix}"))
{
var name = Path.GetFileName(file);
if (name.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
continue;
var candidate = name.Substring(prefix.Length, name.Length - prefix.Length - suffix.Length);
if (candidate.Length == 0 || !char.IsDigit(candidate[0]))
continue;
s_cachedUnitySdkVersion = candidate;
return candidate;
}
throw new FileNotFoundException($"No {prefix}*{suffix} package found in {sdkNugetsPath}");
}
View on GitHub (pinned to 225b0fbdb5)
Solutions
- Reinstall or repair the Unity Editor so the bundled SDK nuget feed directory is present at the expected path.
- Verify the editor contents path (EditorApplication.applicationContentsPath) is intact and not partially deleted.
- If you relocated editor contents, restore the original layout expected by the version.
Defensive patterns
Strategy: validation
Validate before calling
var sdkNugetsPath = ResolveSdkNugetsPath(); // your path source
if (!Directory.Exists(sdkNugetsPath))
throw new DirectoryNotFoundException(
$"Unity SDK nuget feed missing; reinstall/repair the editor. Expected at {sdkNugetsPath}"); Prevention
- Keep the editor install intact; do not delete contents under applicationContentsPath.
- Exclude the editor install from aggressive cleanup/antivirus scans.
- After any install modification, verify the SDK feed directory exists.
When it happens
Trigger: Generating MSBuild props/targets for script compilation when the bundled SDK nuget feed folder is absent from the editor contents.
Common situations: Corrupt or partial Unity Editor install. A custom/non-standard editor layout where the SDK feed lives elsewhere. Files removed by an antivirus or cleanup tool.
Related errors
- No {prefix}*{suffix} package found in {sdkNugetsPath}
- Bundled dotnet SDK not found at {sdkRoot}
- No SDK with a valid .version file found under {sdkRoot}
- Unsupported architecture {RuntimeInformation.ProcessArchitec
- Unsupported architecture {RuntimeInformation.ProcessArchitec
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/7e8841359f46a9bf.
Report an issue: GitHub.