{"record":{"id":"0b6195c85a60ffde","repo":"stride3d/stride","slug":"unable-to-find-project","errorCode":null,"errorMessage":"Unable to find project","messagePattern":"Unable to find project","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/PackageSession.cs","lineNumber":702,"sourceCode":"            }\n        }\n    }\n\n    /// <summary>\n    /// Adds an existing package to the current session.\n    /// </summary>\n    /// <param name=\"projectPath\">The project or package path.</param>\n    /// <param name=\"logger\">The session result.</param>\n    /// <param name=\"loadParametersArg\">The load parameters argument.</param>\n    /// <exception cref=\"ArgumentNullException\">packagePath</exception>\n    /// <exception cref=\"ArgumentException\">Invalid relative path. Expecting an absolute package path;packagePath</exception>\n    /// <exception cref=\"FileNotFoundException\">Unable to find package</exception>\n    public PackageContainer AddExistingProject(UFile projectPath, ILogger logger, PackageLoadParameters? loadParametersArg = null)\n    {\n        ArgumentNullException.ThrowIfNull(projectPath);\n        ArgumentNullException.ThrowIfNull(logger);\n        if (!projectPath.IsAbsolute) throw new ArgumentException(\"Invalid relative path. Expecting an absolute project path\", nameof(projectPath));\n        if (!File.Exists(projectPath)) throw new FileNotFoundException(\"Unable to find project\", projectPath);\n\n        var loadParameters = loadParametersArg ?? PackageLoadParameters.Default();\n\n        Package package;\n        PackageContainer project;\n        try\n        {\n            // Enable reference analysis caching during loading\n            AssetReferenceAnalysis.EnableCaching = true;\n\n            project = LoadProject(logger, projectPath.ToOSPath(), loadParametersArg);\n            Projects.Add(project);\n\n            package = project.Package;\n\n            // Load all missing references/dependencies\n            LoadMissingDependencies(logger, loadParameters);\n","sourceCodeStart":684,"sourceCodeEnd":720,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/PackageSession.cs#L684-L720","documentation":"AddExistingProject throws FileNotFoundException when the (absolute) project path does not exist on disk. It validates the file exists before attempting to load the package so the caller gets a clear 'Unable to find project' error.","triggerScenarios":"Calling session.AddExistingProject(path, logger) with a valid absolute path where File.Exists(path) is false — wrong filename, missing extension, or project not yet generated.","commonSituations":"Typos in the project file name, pointing at the folder instead of the .csproj, project deleted or not yet restored/generated (e.g. codegen step not run), path casing/drive issues.","solutions":["Check File.Exists(projectPath) before calling and surface a friendly message","Verify the path points at the actual .csproj file, not the directory","Run any project generation/codegen step that creates the file first","Fix the configured path (typo, wrong base directory)"],"exampleFix":"// before\nsession.AddExistingProject(@\"D:\\src\\MyGame\\MyGame.cproj\", logger); // typo\n// after\nvar path = new UFile(@\"D:\\src\\MyGame\\MyGame.csproj\");\nif (!File.Exists(path)) throw new FileNotFoundException($\"Project not found: {path}\", path);\nsession.AddExistingProject(path, logger);","handlingStrategy":"validation","validationCode":"if (!File.Exists(projectPath))\n    throw new FileNotFoundException($\"Project file not found: {Path.GetFullPath(projectPath)}\", projectPath);","typeGuard":null,"tryCatchPattern":"try { session.AddExistingProject(path, logger); }\ncatch (FileNotFoundException ex) { logger.Error(ex, \"Project file missing — check path or generate the project\"); }","preventionTips":["Verify project files exist before loading sessions","Point at the .csproj, not its directory","Run project generation steps before AddExistingProject"],"tags":["file","io","projects"],"backgroundTag":"file-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}