/// <summary> /// Override of IDisposable.Dispose to handle implementation details of dispose /// </summary> public void Dispose() { GC.SuppressFinalize(this); if (this._businessLogicModel != null) { try { this._businessLogicModel.Dispose(); } catch (System.Runtime.Remoting.RemotingException) { // This condition is unlikely but possible if the 2nd AppDomain // is torn down independently. There is nothing we can do here, // as it is not a user error. We catch and ignore solely to // prevent the wizard from showing a fatal error the user does // not understand. } this._businessLogicModel = null; } IDisposable disposable = this._clientBuildManager as IDisposable; if (disposable != null) { disposable.Dispose(); } this._clientBuildManager = null; }
/// <summary> /// Inspect the application and create mappings for all types /// </summary> private void InitializeInternal() { if (Initialized) { return; } // Can this go async? _compiler = new ClientBuildManager(@"/", WebRootFolder, null, new ClientBuildManagerParameter() { }); SetHttpRuntimeAppDomainAppPath(); // In larger suites, this may be more cost effective to run if (!_SkipPrecompile) { _compiler.PrecompileApplication(); } ConfigureBuildManager(); // Async? CrawlWebApplication(); CreateHttpApplication(); Initialized = true; }
/// <summary> /// Validates the integrity of the <see cref="OpenRiaServices.DomainServices.Server.DomainService"/>s exposed by the target Web Application /// in a separate <see cref="AppDomain"/> /// </summary> private void ValidateDomainServices() { IEnumerable <string> assemblies = new[] { this.GetFileName(this.Assembly) }.Concat( this.ReferenceAssemblies.Select(i => this.GetFileName(i))); this.WarnIfAssembliesDontExist(assemblies); using (ClientBuildManager cbm = new ClientBuildManager(/* appVirtualDir */ "/", this.ProjectDirectory)) { // Surface a HttpRuntime initialization error that would otherwise manifest as a NullReferenceException // This can occur when the build environment is configured incorrectly if (System.Web.Hosting.HostingEnvironment.InitializationException != null) { throw new InvalidOperationException( Resource.HttpRuntimeInitializationError, System.Web.Hosting.HostingEnvironment.InitializationException); } using (DomainServiceValidator validator = (DomainServiceValidator)cbm.CreateObject(typeof(DomainServiceValidator), false)) { // Transfer control to Web Application AppDomain to invoke the validator validator.Validate(assemblies.ToArray(), this.LoggingService); } } }
private static CommandHost CreateWorkerAppDomainWithHost(string virtualPath, string physicalPath, Type hostType) { var clientBuildManager = new ClientBuildManager(virtualPath, physicalPath); // By forcing the CBM to build App_Code, etc, we ensure that the ASP.NET BuildManager // is in a state where it can safely (i.e. in a multi-threaded safe way) process // multiple concurrent calls to "GetCompiledAssembly". clientBuildManager.CompileApplicationDependencies(); return((CommandHost)clientBuildManager.CreateObject(hostType, false)); }
public static void Main(string[] args) { // Check arguments. if (ValidateAndSetArguments(args)) { _cbmParameter = new ClientBuildManagerParameter(); _cbmParameter.PrecompilationFlags = _flags; _cbmParameter.StrongNameKeyContainer = _keyContainer; builder = new ClientBuildManager(_vPath, _pPath, _tPath, _cbmParameter); // Pre-compile. if (Precompiler()) { Console.Write("Build succeeded. Result is at " + _tPath + "."); } } }
private void PrecompileHost(CassiniDev.Host host) { var flags = PrecompilationFlags.ForceDebug | PrecompilationFlags.OverwriteTarget | PrecompilationFlags.Updatable; var cbmp = new ClientBuildManagerParameter(); cbmp.PrecompilationFlags = flags; var cbm = new ClientBuildManager(host.VirtualPath, host.PhysicalPath); cbm.CompileApplicationDependencies(); if (!cbm.IsHostCreated) { return; } cbm.CompileFile("/Default.aspx"); System.Diagnostics.Debug.WriteLine("Precompile complete"); }
public static void PrecompileAspx(string appVirtualDir) { Console.Write("Precompiling ASPX files in virtual directory '" + appVirtualDir + "'..."); Stopwatch stopwatch = Stopwatch.StartNew(); try { ClientBuildManager buildManager = new ClientBuildManager(appVirtualDir, null); buildManager.PrecompileApplication(); } catch (HttpParseException ex) { throw new ApplicationException("Failed to precompile ASPX file '" + ex.VirtualPath + "' - error on line " + ex.Line + ": " + ex.Message, ex); } catch (Exception ex) { throw new ApplicationException("Failed to precompile ASPX files in '" + appVirtualDir + "'.", ex); } stopwatch.Stop(); Console.WriteLine(" Done ({0:n1} seconds)", stopwatch.Elapsed.TotalSeconds); }
private static OrchardHost CreateOrchardHost(string virtualPath, string physicalPath) { clientBuildManager = new ClientBuildManager(virtualPath, physicalPath); clientBuildManager.CompileApplicationDependencies(); return((OrchardHost)clientBuildManager.CreateObject(typeof(OrchardHost), false)); }
public ClientBuildManagerWrapper(string webApplicationName, string webApplicationPhysicalPath, string preCompileOutputpath, ClientBuildManagerParameter parameter) { _buildManager = new ClientBuildManager(webApplicationName, webApplicationPhysicalPath, preCompileOutputpath, parameter); }