public AppResourcesAssemblyBuilder (string canonicAssemblyName, string baseAssemblyPath, AppResourcesCompiler appres) { this.appResourcesCompiler = appres; this.baseAssemblyPath = baseAssemblyPath; this.baseAssemblyDirectory = Path.GetDirectoryName (baseAssemblyPath); this.canonicAssemblyName = canonicAssemblyName; config = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection; if (config == null || !CodeDomProvider.IsDefinedLanguage (config.DefaultLanguage)) throw new ApplicationException ("Could not get the default compiler."); ci = CodeDomProvider.GetCompilerInfo (config.DefaultLanguage); if (ci == null || !ci.IsCodeDomProviderTypeValid) throw new ApplicationException ("Failed to obtain the default compiler information."); }
public AppResourcesAssemblyBuilder(string canonicAssemblyName, string baseAssemblyPath, AppResourcesCompiler appres) { this.appResourcesCompiler = appres; this.baseAssemblyPath = baseAssemblyPath; this.baseAssemblyDirectory = Path.GetDirectoryName(baseAssemblyPath); this.canonicAssemblyName = canonicAssemblyName; config = WebConfigurationManager.GetWebApplicationSection("system.web/compilation") as CompilationSection; if (config == null || !CodeDomProvider.IsDefinedLanguage(config.DefaultLanguage)) { throw new ApplicationException("Could not get the default compiler."); } ci = CodeDomProvider.GetCompilerInfo(config.DefaultLanguage); if (ci == null || !ci.IsCodeDomProviderTypeValid) { throw new ApplicationException("Failed to obtain the default compiler information."); } }
Assembly GetLocalResourcesAssembly() { string path; Assembly asm; path = VirtualPathUtility.GetDirectory(resource); asm = AppResourcesCompiler.GetCachedLocalResourcesAssembly(path); if (asm == null) { AppResourcesCompiler ac = new AppResourcesCompiler(path); asm = ac.Compile(); if (asm == null) { throw new MissingManifestResourceException("A resource object was not found at the specified virtualPath."); } } return(asm); }
void InitType (HttpContext context) { lock (this_lock) { if (!needs_init) return; try { string physical_app_path = HttpRuntime.AppDomainAppPath; string app_file = null; app_file = Path.Combine (physical_app_path, "Global.asax"); if (!File.Exists (app_file)) { app_file = Path.Combine (physical_app_path, "global.asax"); if (!File.Exists (app_file)) app_file = null; } #if NET_4_0 BuildManager.CallPreStartMethods (); BuildManager.CompilingTopLevelAssemblies = true; #endif AppResourcesCompiler ac = new AppResourcesCompiler (context); ac.Compile (); #if WEBSERVICES_DEP AppWebReferencesCompiler awrc = new AppWebReferencesCompiler (); awrc.Compile (); #endif // Todo: Generate profile properties assembly from Web.config here AppCodeCompiler acc = new AppCodeCompiler (); acc.Compile (); BuildManager.AllowReferencedAssembliesCaching = true; // Get the default machine *.browser files. string default_machine_browsers_path = Path.Combine (HttpRuntime.MachineConfigurationDirectory, "Browsers"); default_machine_browsers_files = new string[0]; if (Directory.Exists (default_machine_browsers_path)) { default_machine_browsers_files = Directory.GetFiles (default_machine_browsers_path, "*.browser"); } // Note whether there are any App_Data/Mono_Machine_Browsers/*.browser files. If there // are we will be using them instead of the default machine *.browser files. string app_mono_machine_browsers_path = Path.Combine (Path.Combine (physical_app_path, "App_Data"), "Mono_Machine_Browsers"); app_mono_machine_browsers_files = new string[0]; if (Directory.Exists (app_mono_machine_browsers_path)) { app_mono_machine_browsers_files = Directory.GetFiles (app_mono_machine_browsers_path, "*.browser"); } // Note whether there are any App_Browsers/*.browser files. If there // are we will be using *.browser files for sniffing in addition to browscap.ini string app_browsers_path = Path.Combine (physical_app_path, "App_Browsers"); app_browsers_files = new string[0]; if (Directory.Exists (app_browsers_path)) { app_browsers_files = Directory.GetFiles (app_browsers_path, "*.browser"); } #if NET_4_0 BuildManager.CompilingTopLevelAssemblies = false; #endif app_type = BuildManager.GetPrecompiledApplicationType (); if (app_type == null && app_file != null) { app_type = BuildManager.GetCompiledType ("~/" + Path.GetFileName (app_file)); if (app_type == null) { string msg = String.Format ("Error compiling application file ({0}).", app_file); throw new ApplicationException (msg); } } else if (app_type == null) { app_type = typeof (System.Web.HttpApplication); app_state = new HttpApplicationState (); } WatchLocationForRestart ("?lobal.asax"); #if CODE_DISABLED_UNTIL_SYSTEM_CONFIGURATION_IS_FIXED // This is the correct behavior, but until // System.Configuration is fixed to properly reload // configuration when it is modified on disk, we need to use // the recursive watchers below. WatchLocationForRestart ("?eb.?onfig"); #else // This is to avoid startup delays. Inotify/FAM code looks // recursively for all subdirectories and adds them to the // watch set. This can take a lot of time for deep directory // trees (see bug #490497) ThreadPool.QueueUserWorkItem (delegate { try { WatchLocationForRestart (String.Empty, "?eb.?onfig", true); } catch (Exception e) { Console.Error.WriteLine (e); } }, null); #endif needs_init = false; } catch (Exception) { if (BuildManager.CodeAssemblies != null) BuildManager.CodeAssemblies.Clear (); if (BuildManager.TopLevelAssemblies != null) BuildManager.TopLevelAssemblies.Clear (); if (WebConfigurationManager.ExtraAssemblies != null) WebConfigurationManager.ExtraAssemblies.Clear (); throw; } } }
Assembly GetLocalResourcesAssembly () { string path; Assembly asm; path = VirtualPathUtility.GetDirectory (resource); asm = AppResourcesCompiler.GetCachedLocalResourcesAssembly (path); if (asm == null) { AppResourcesCompiler ac = new AppResourcesCompiler (path); asm = ac.Compile (); if (asm == null) throw new MissingManifestResourceException ("A resource object was not found at the specified virtualPath."); } return asm; }