Example #1
0
        /// <summary>
        /// Compile all models added to this assembly into a .dll file and write
        /// their code out to disk.
        /// </summary>
        public bool CompileCSharpCode()
        {
            // Generate the output C# files for all of the included classes and aggregate the .cs filenames
            string[] filenames = this.models.Select(
                m =>
            {
                m.GenerateCCsharpClass(this.internalNamespace);
                return(m.OutputFilePath);
            }).ToArray();

            return(CompilationUtilities.CompileAssemblyFromFiles(this.OutputDirectory, this.AssemblyName, filenames, this.internalNamespace));
        }
Example #2
0
        /// <summary>
        /// Compile this class into a single-class assembly. Mostly useful for unit testing.
        /// See <see cref="CodeDomAssemblyCoordinator"/> for more typical compilation.
        /// </summary>
        public bool CompileClassFromGeneratedCsFile(CodeDomNamespace namesp)
        {
            if (!this.isReadyToCompile)
            {
                this.GenerateCCsharpClass(namesp);
            }

            return(CompilationUtilities.CompileAssemblyFromFiles(
                       this.filePath,
                       namesp.Name,
                       new[] { this.OutputFilePath },
                       namesp));
        }