Example #1
0
        protected virtual void ConfigureCompiler(XcstCompiler compiler)
        {
            compiler.PackageTypeResolver  = typeName => BuildManager.GetType(typeName, throwOnError: false);
            compiler.PackageFileDirectory = HostingEnvironment.MapPath("~/App_Code");
            compiler.PackageFileExtension = FileExtension;
            compiler.UseLineDirective     = true;
            compiler.TargetVisibility     = CodeVisibility.Public;

            if (this.IsFileInCodeDir)
            {
                compiler.NamedPackage = true;
            }
            else
            {
                compiler.SetTargetBaseTypes(this.PageType);
                compiler.TargetNamespace = this.GeneratedTypeNamespace;
                compiler.TargetClass     = this.GeneratedTypeName;

                compiler.ModuleResolver = (_moduleResolver = new LoggingResolver(new XmlUrlResolver()));

                Xcst.Web.Extension.ExtensionLoader.SetPage(compiler, true);
            }

            Xcst.Web.Extension.ExtensionLoader.SetApplicationUri(compiler, _applicationUri);
            Xcst.Web.Extension.ExtensionLoader.SetGenerateHref(compiler, true);
        }
Example #2
0
        static (CompileResult result, string packageName) GenerateCode(Uri packageUri, string testName, string testNamespace)
        {
            XcstCompiler compiler = CreateCompiler();

            compiler.TargetNamespace = testNamespace;
            compiler.TargetClass     = testName;
            compiler.UsePackageBase  = testNamespace;
            compiler.SetTargetBaseTypes(typeof(TestBase));

            CompileResult result = compiler.Compile(packageUri);

            return(result, compiler.TargetNamespace + "." + compiler.TargetClass);
        }