Hack Forums
[C#] [Pre-release] EASY C# COMPILER WRAPPER - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] [Pre-release] EASY C# COMPILER WRAPPER (/showthread.php?tid=5743868)



[Pre-release] EASY C# COMPILER WRAPPER - gigajew - Oct 27, 2017

I've written this thread twice now and Microsoft Edge browser removed my text and backed me out. Needless to say jimmies have been rustled, so I'll populate this with information later. New versions of this compiler wrapper will be posted in this thread. If not in the OP, then in a reply.

Usage

Code
    class Program
    {
        static void Main(string[] args)
        {
            var compiler = new Compiler();
            var settings = new CompilerSettings("Stub");

            // populate settings
            settings.AddSource(Properties.Resources.source);
            settings.BuildMode = BuildMode.Release;
            settings.BuildType = BuildType.Console;

            // compile
            var result = compiler.Compile(settings, "outputAssembly.exe");

            // display result to user (built-in!)
            compiler.DisplayResult(result);
        }
    }


Features
  • Easy to use properties (even for beginners)
  • Easily add resources from byte[], stream, or filename
  • Built-in result prompt, asks if you want to open the output directory
Download



RE: [Pre-release] EASY C# COMPILER WRAPPER - 0xDEAD10CC - Oct 27, 2017

I built a tool like this a few years back too which was pretty basic but flexible for changing the .NET version and such. It was a useful tool for when you don't have a C# compiler to work with, and don't have internet to use online compilers.


RE: [Pre-release] EASY C# COMPILER WRAPPER - Ninja - Oct 27, 2017

What if the compilation returns errors? How will those errors be handled?


RE: [Pre-release] EASY C# COMPILER WRAPPER - gigajew - Oct 27, 2017

It returns the .NET framework CompilerResults from https://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerresults(v=vs.110).aspx


RE: [Pre-release] EASY C# COMPILER WRAPPER - Ninja - Oct 27, 2017

(Oct 27, 2017 06:36 PM)gigajew Wrote:  It returns the .NET framework CompilerResults from https://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerresults(v=vs.110).aspx

Ah, that makes sense. I have no experience with CodeDom in the slightest hence I asked.