Assembly GetAssemblyFromSource(string vpath) { vpath = UrlUtils.Combine(BaseVirtualDir, vpath); string realPath = MapPath(vpath, false); if (!File.Exists(realPath)) { ThrowParseException("File " + vpath + " not found"); } AddSourceDependency(vpath); CompilerResults result; string tmp; CompilerParameters parameters; CodeDomProvider provider = BaseCompiler.CreateProvider(HttpContext.Current, language, out parameters, out tmp); if (provider == null) { throw new HttpException("Cannot find provider for language '" + language + "'."); } AssemblyBuilder abuilder = new AssemblyBuilder(provider); abuilder.CompilerOptions = parameters; abuilder.AddAssemblyReference(BuildManager.GetReferencedAssemblies() as List <Assembly>); abuilder.AddCodeFile(realPath); result = abuilder.BuildAssembly(new VirtualPath(vpath)); if (result.NativeCompilerReturnValue != 0) { using (StreamReader reader = new StreamReader(realPath)) { throw new CompilationException(realPath, result.Errors, reader.ReadToEnd()); } } AddAssembly(result.CompiledAssembly, true); return(result.CompiledAssembly); }