Unity-Technologies/UnityCsReference · critical · FileNotFoundException
No {prefix}*{suffix} package found in {sdkNugetsPath}
Error message
No {prefix}*{suffix} package found in {sdkNugetsPath} What it means
Thrown by GetUnitySdkVersion (UnityEditorMSBuildPropsTargetsGeneration.cs:252, FileNotFoundException) when the SDK nuget feed directory exists but contains no file matching the Unity.Sdk.*.nupkg pattern. Files ending in .symbols.nupkg are skipped, and candidates whose extracted version does not start with a digit are ignored. If no qualifying package remains, the version cannot be determined and global.json cannot be generated.
Source
Thrown at Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs:252
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}");
}
private static string s_cachedDotnetRuntimeVersion;
// The .NET SDK version written to the generated global.json (sdk.version) must match the .NET SDK
// Unity ships. Read it from the SDK's authoritative ".version" metadata (the version is on the
// second line) rather than trusting the folder name, so a .NET upgrade (8 -> 10 -> ...) needs no
// change here. We return the full version (e.g. "10.0.102"), preserving minor/patch, and pick the
// highest if more than one SDK is present.
private static string GetDotnetRuntimeVersion()
{
if (s_cachedDotnetRuntimeVersion != null)
return s_cachedDotnetRuntimeVersion;
var sdkRoot = Path.Combine(EditorApplication.applicationScriptingPath, "DotNetSdk", "sdk");
if (!Directory.Exists(sdkRoot))
throw new DirectoryNotFoundException($"Bundled dotnet SDK not found at {sdkRoot}");
View on GitHub (pinned to 225b0fbdb5)
Solutions
- Reinstall/repair the Unity Editor to restore the Unity.Sdk.<version>.nupkg in the bundled feed.
- Ensure the package file is named 'Unity.Sdk.<digit-starting-version>.nupkg' (not only a .symbols.nupkg) and was not quarantined by antivirus.
Defensive patterns
Strategy: validation
Validate before calling
const string prefix = "Unity.Sdk.", suffix = ".nupkg";
var pkg = Directory.EnumerateFiles(sdkNugetsPath, $"{prefix}*{suffix}")
.FirstOrDefault(f => !f.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase)
&& char.IsDigit(Path.GetFileName(f)
.Substring(prefix.Length)[0]));
if (pkg == null)
throw new FileNotFoundException(
$"Unity.Sdk.*.nupkg not found in {sdkNugetsPath}; repair the editor install."); Prevention
- Do not remove the main Unity.Sdk.<version>.nupkg (leave symbol packages aside).
- Ensure antivirus has not quarantined the package.
- If you maintain a custom feed, ship a correctly named Unity.Sdk.<digit-version>.nupkg.
When it happens
Trigger: The feed directory is present but the Unity.Sdk package is missing, only symbol packages remain, or all candidate package names fail the 'starts with a digit' version check.
Common situations: Partial install where the main package was deleted but symbols remain. A repackaged/corrupt SDK feed. A manually modified feed folder.
Related errors
- Unity SDK nuget feed not found at {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/846fe772bd8ad410.
Report an issue: GitHub.