/* * Perform initialization work that should only be done once (per app domain). */ private void Initialize() { Debug.Assert(_caches == null); // Register an AssemblyResolve event AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(this.ResolveAssembly); _globalAsaxVirtualPath = HttpRuntime.AppDomainAppVirtualPathObject.SimpleCombine( HttpApplicationFactory.applicationFileName); _webHashFilePath = Path.Combine(HttpRuntime.CodegenDirInternal, "hash\\hash.web"); // Indicate whether we should ignore the top level compilation exceptions. // In CBM case, we want to continue processing the page and return partial info even // if the code files fail to compile. _skipTopLevelCompilationExceptions = BuildManagerHost.InClientBuildManager; // Deal with precompilation if we're in that mode SetPrecompilationInfo(HostingEnvironment.HostingParameters); MultiTargetingUtil.EnsureFrameworkNamesInitialized(); // The init code depends on whether we're precompiling or running an app if (_precompTargetPhysicalDir != null) { // If the app is already precompiled, fail FailIfPrecompiledApp(); PrecompilationModeInitialize(); } else { // Check if this application has been precompiled by aspnet_compiler.exe if (IsPrecompiledApp) { PrecompiledAppRuntimeModeInitialize(); } else { RegularAppRuntimeModeInitialize(); } } _scriptVirtualDir = Util.GetScriptLocation(); // Top level directories that have a special semantic _excludedTopLevelDirectories = new CaseInsensitiveStringSet(); _excludedTopLevelDirectories.Add(HttpRuntime.BinDirectoryName); _excludedTopLevelDirectories.Add(HttpRuntime.CodeDirectoryName); _excludedTopLevelDirectories.Add(HttpRuntime.ResourcesDirectoryName); _excludedTopLevelDirectories.Add(HttpRuntime.LocalResourcesDirectoryName); _excludedTopLevelDirectories.Add(HttpRuntime.WebRefDirectoryName); _excludedTopLevelDirectories.Add(HttpRuntime.ThemesDirectoryName); // Top level directories that are not requestable // It's the same as _excludedTopLevelDirectories, except that we allow // the bin directory to avoid a v1 breaking change (VSWhidbey 465018) _forbiddenTopLevelDirectories = new CaseInsensitiveStringSet(); _forbiddenTopLevelDirectories.Add(HttpRuntime.CodeDirectoryName); _forbiddenTopLevelDirectories.Add(HttpRuntime.ResourcesDirectoryName); _forbiddenTopLevelDirectories.Add(HttpRuntime.LocalResourcesDirectoryName); _forbiddenTopLevelDirectories.Add(HttpRuntime.WebRefDirectoryName); _forbiddenTopLevelDirectories.Add(HttpRuntime.ThemesDirectoryName); LoadLicensesAssemblyIfExists(); }
// Compute the list of subdirectories that should not be compiled with // the top level Code private void EnsureExcludedCodeSubDirectoriesComputed() { if (_excludedCodeSubdirectories != null) return; _excludedCodeSubdirectories = new CaseInsensitiveStringSet(); // Get the list of sub directories that will be compiled separately CodeSubDirectoriesCollection codeSubDirectories = CompilationUtil.GetCodeSubDirectories(); // Add them to the exclusion list of the top level code directory if (codeSubDirectories != null) { foreach (CodeSubDirectory entry in codeSubDirectories) { _excludedCodeSubdirectories.Add(entry.DirectoryName); } } }