{"record":{"id":"1eeb73b349ea7e43","repo":"egametang/ET","slug":"you-must-run-hybridclr-installer-after-upgrading","errorCode":null,"errorMessage":"You must run `HybridCLR/Installer` after upgrading package","messagePattern":"You must run `HybridCLR/Installer` after upgrading package","errorType":"exception","errorClass":"BuildFailedException","httpStatus":null,"severity":"critical","filePath":"Packages/cn.etetet.hybridclr/Scripts/Editor/Share/BuildProcessors/CheckSettings.cs","lineNumber":65,"sourceCode":"            }\n            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);\n            ScriptingImplementation curScriptingImplementation = PlayerSettings.GetScriptingBackend(NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup));\n            ScriptingImplementation targetScriptingImplementation = ScriptingImplementation.IL2CPP;\n            if (curScriptingImplementation != targetScriptingImplementation)\n            {\n                Debug.LogError($\"[CheckSettings] current ScriptingBackend:{curScriptingImplementation}，have been switched to:{targetScriptingImplementation} automatically\");\n                PlayerSettings.SetScriptingBackend(NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup), targetScriptingImplementation);\n            }\n\n            var installer = new Installer.InstallerController();\n            if (!installer.HasInstalledHybridCLR())\n            {\n                throw new BuildFailedException($\"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'\");\n            }\n\n            if (installer.PackageVersion != installer.InstalledLibil2cppVersion)\n            {\n                throw new BuildFailedException($\"You must run `HybridCLR/Installer` after upgrading package\");\n            }\n\n            HybridCLRSettings gs = SettingsUtil.HybridCLRSettings;\n            if (((gs.hotUpdateAssemblies?.Length + gs.hotUpdateAssemblyDefinitions?.Length) ?? 0) == 0)\n            {\n                Debug.LogWarning(\"[CheckSettings] No hot update modules configured in HybridCLRSettings\");\n            }\n\n            if (!DisableMethodBridgeDevelopmentFlagChecking)\n            {\n                string methodBridgeFile = $\"{SettingsUtil.GeneratedCppDir}/MethodBridge.cpp\";\n                var match = Regex.Match(File.ReadAllText(methodBridgeFile), @\"// DEVELOPMENT=(\\d)\");\n                if (match.Success)\n                {\n                    int developmentFlagInMethodBridge = int.Parse(match.Groups[1].Value);\n                    int developmentFlagInEditorSettings = EditorUserBuildSettings.development ? 1 : 0;\n                    if (developmentFlagInMethodBridge != developmentFlagInEditorSettings)\n                    {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.hybridclr/Scripts/Editor/Share/BuildProcessors/CheckSettings.cs#L47-L83","documentation":"Thrown by CheckSettings.OnPreprocessBuild when the HybridCLR package version does not match the version of libil2cpp that was patched during installation. After upgrading the HybridCLR package, the installer must be re-run to apply new patches to libil2cpp. If the versions diverge, the build is aborted because the stale patches would produce incorrect or broken hot-update code.","triggerScenarios":"Building with HybridCLR enabled after the package was upgraded (e.g. via UPM/registry) but the installer was not re-run. PackageVersion reflects the current package, InstalledLibil2cppVersion reflects what the installer last wrote; a mismatch means the local libil2cpp is stale.","commonSituations":"Upgrading the HybridCLR Unity package via Package Manager without re-running the installer; a teammate pulls new code with a newer package version but didn't run the installer; the Library folder was partially cleared, resetting one version but not the other.","solutions":["Run HybridCLR > Installer > Install again to patch libil2cpp with the current package version, then rebuild.","Verify the package version in Packages/manifest.json matches what you expect after upgrade.","For CI/CD, always run the installer step after pulling dependency updates.","If the installer itself fails, check the console for the specific error and resolve it before retrying."],"exampleFix":"// workflow fix — no code change:\n// 1. Upgrade HybridCLR package via Package Manager\n// 2. Unity menu > HybridCLR > Installer > Install\n// 3. Rebuild\n\n// for automation:\n// -executeMethod HybridCLR.Editor.Installer.InstallController.Install\n// then build\n\n// before\nif (installer.PackageVersion != installer.InstalledLibil2cppVersion)\n    throw new BuildFailedException(...);\n\n// after — informative guidance\nif (installer.PackageVersion != installer.InstalledLibil2cppVersion)\n{\n    Debug.LogError($\"Version mismatch: package={installer.PackageVersion}, installed={installer.InstalledLibil2cppVersion}. Run HybridCLR > Installer.\");\n    return;\n}","handlingStrategy":"validation","validationCode":"var installer = new Installer.InstallerController();\nif (installer.PackageVersion != installer.InstalledLibil2cppVersion)\n{\n    Debug.LogError($\"HybridCLR version mismatch: package={installer.PackageVersion}, \" +\n        $\"installed={installer.InstalledLibil2cppVersion}. Run HybridCLR > Installer to update.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    BuildPipeline.BuildPlayer(scenes, outputPath, buildTarget, buildOptions);\n}\ncatch (BuildFailedException ex) when (ex.Message.Contains(\"after upgrading package\"))\n{\n    Debug.LogError(\"HybridCLR package version changed. Run HybridCLR > Installer > Install, then rebuild.\");\n}","preventionTips":["After upgrading the HybridCLR package via Package Manager, always re-run the installer.","For CI/CD, run the installer step every time dependencies are updated.","Communicate package upgrades to all team members so they re-run the installer locally.","Check installer.PackageVersion vs InstalledLibil2cppVersion before building to catch mismatches early."],"tags":["hybridclr","installer","version-mismatch","build-preprocessing","package-upgrade"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}