{"record":{"id":"35a34b98bb241de0","repo":"Unity-Technologies/UnityCsReference","slug":"use-of-reference-assemblies-is-always-enabled","errorCode":null,"errorMessage":"Use of reference assemblies is always enabled","messagePattern":"Use of reference assemblies is always enabled","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs","lineNumber":46,"sourceCode":"    [Flags]\n    public enum RequestScriptCompilationOptions\n    {\n        None,\n        CleanBuildCache\n    }\n\n    public class ScriptCompilerOptions\n    {\n        public string RoslynAnalyzerRulesetPath { get; set; }\n        public string[] RoslynAnalyzerDllPaths { get; set; }\n        public string[] RoslynAdditionalFilePaths { get; set; }\n        public string AnalyzerConfigPath {get; set;}\n        public bool AllowUnsafeCode { get; set; }\n\n        [Obsolete(\"Use of reference assemblies is always enabled\", true)]\n        public bool EmitReferenceAssembly\n        {\n            get { throw new NotImplementedException(\"Use of reference assemblies is always enabled\"); }\n            set { throw new NotImplementedException(\"Use of reference assemblies is always enabled\"); }\n        }\n\n        internal bool UseDeterministicCompilation { get; set; }\n        public string[] AdditionalCompilerArguments { get; set; }\n        public CodeOptimization CodeOptimization { get; set; }\n        public ApiCompatibilityLevel ApiCompatibilityLevel { get; set; }\n        public EditorAssembliesCompatibilityLevel EditorAssembliesCompatibilityLevel { get; set; }\n        public string[] ResponseFiles { get; set; }\n        public string LanguageVersion { get; internal set; } // Requires a refresh sent to the Code Editor package if made public\n\n        public ScriptCompilerOptions()\n        {\n            AllowUnsafeCode = false;\n            ApiCompatibilityLevel = ApiCompatibilityLevel.NET_Unity_4_8;\n            EditorAssembliesCompatibilityLevel = EditorAssembliesCompatibilityLevel.Default;\n            ResponseFiles = Array.Empty<string>();\n            RoslynAnalyzerDllPaths = Array.Empty<string>();","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs#L28-L64","documentation":"ScriptCompilerOptions.EmitReferenceAssembly is marked [Obsolete(..., true)] and both getter and setter throw NotImplementedException unconditionally — reference assemblies are now always enabled and the property is hard-banned. Any read or write of it throws at runtime (and is a compile error for new code).","triggerScenarios":"Reading or writing ScriptCompilerOptions.EmitReferenceAssembly (the property always throws NotImplementedException).","commonSituations":"Legacy code or a third-party package that toggled reference assembly emission before it became mandatory.","solutions":["Remove all uses of EmitReferenceAssembly from your code; reference assemblies are always on.","Upgrade packages that still reference the obsolete property."],"exampleFix":"// before\noptions.EmitReferenceAssembly = true;\n// after\n// (remove the line; reference assemblies are always enabled)","handlingStrategy":"fallback","validationCode":"// There is nothing to validate: the property always throws.\n// Remove the call site entirely; reference assemblies are mandatory.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete all references to EmitReferenceAssembly from your code and dependencies.","Watch for compiler obsolete-as-error warnings when upgrading packages that touched it."],"tags":["script-compilation","obsolete","api","deprecation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}