コード例 #1
0
ファイル: Csi.cs プロジェクト: robertoenbarcelona/roslyn
        internal static int Main(string[] args)
        {
            try
            {
                var responseFile = Path.Combine(AppContext.BaseDirectory, InteractiveResponseFileName);

                var compiler = new CSharpInteractiveCompiler(
                    responseFile: responseFile,
                    baseDirectory: Directory.GetCurrentDirectory(), 
                    sdkDirectoryOpt: CorLightup.Desktop.TryGetRuntimeDirectory(),
                    args: args,
                    analyzerLoader: new NotImplementedAnalyzerLoader());

                var runner = new CommandLineRunner(
                    ConsoleIO.Default,
                    compiler,
                    CSharpScriptCompiler.Instance,
                    CSharpObjectFormatter.Instance);

                return runner.RunInteractive();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return 1;
            }
        }
コード例 #2
0
ファイル: Csi.cs プロジェクト: zlphoenix/roslyn
        internal static int Main(string[] args)
        {
            try
            {
                var responseFile = Path.Combine(AppContext.BaseDirectory, InteractiveResponseFileName);

                var compiler = new CSharpInteractiveCompiler(
                    responseFile: responseFile,
                    baseDirectory: Directory.GetCurrentDirectory(),
                    sdkDirectoryOpt: CorLightup.Desktop.TryGetRuntimeDirectory(),
                    args: args,
                    clientDirectory: AppContext.BaseDirectory,
                    analyzerLoader: new NotImplementedAnalyzerLoader());

                var runner = new CommandLineRunner(
                    ConsoleIO.Default,
                    compiler,
                    CSharpScriptCompiler.Instance,
                    CSharpObjectFormatter.Instance);

                return(runner.RunInteractive());
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.ToString());
                return(1);
            }
        }
コード例 #3
0
ファイル: Csi.cs プロジェクト: isadorasophia/roslyn-kyle
        internal static int Main(string[] args)
        {
            try
            {
                // Note that AppContext.BaseDirectory isn't necessarily the directory containing csi.exe.
                // For example, when executed via corerun it's the directory containing corerun.
                string csiDirectory = Path.GetDirectoryName(typeof(Csi).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName);

                var buildPaths = new BuildPaths(
                    clientDir: csiDirectory,
                    workingDir: Directory.GetCurrentDirectory(),
                    sdkDir: RuntimeMetadataReferenceResolver.GetDesktopFrameworkDirectory(),
                    tempDir: Path.GetTempPath());

                var compiler = new CSharpInteractiveCompiler(
                    responseFile: Path.Combine(csiDirectory, InteractiveResponseFileName),
                    buildPaths: buildPaths,
                    args: args,
                    analyzerLoader: new NotImplementedAnalyzerLoader());

                var runner = new CommandLineRunner(
                    ConsoleIO.Default,
                    compiler,
                    CSharpScriptCompiler.Instance,
                    CSharpObjectFormatter.Instance);

                return(runner.RunInteractive());
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.ToString());
                return(1);
            }
        }
コード例 #4
0
ファイル: Csi.cs プロジェクト: XieShuquan/roslyn
        internal static int Main(string[] args)
        {
            try
            {
                // Note that AppContext.BaseDirectory isn't necessarily the directory containing csi.exe.
                // For example, when executed via corerun it's the directory containing corerun.
                string csiDirectory = Path.GetDirectoryName(typeof(Csi).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName);

                var buildPaths = new BuildPaths(
                    clientDir: csiDirectory,
                    workingDir: Directory.GetCurrentDirectory(),
                    sdkDir: RuntimeMetadataReferenceResolver.GetDesktopFrameworkDirectory(),
                    tempDir: Path.GetTempPath());

                var compiler = new CSharpInteractiveCompiler(
                    responseFile: Path.Combine(csiDirectory, InteractiveResponseFileName),
                    buildPaths: buildPaths,
                    args: args,
                    analyzerLoader: new NotImplementedAnalyzerLoader());

                var runner = new CommandLineRunner(
                    ConsoleIO.Default,
                    compiler,
                    CSharpScriptCompiler.Instance,
                    CSharpObjectFormatter.Instance);

                return runner.RunInteractive();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.ToString());
                return 1;
            }
        }
コード例 #5
0
        private static CommandLineRunner CreateRunner(
            string[] args = null,
            string input = "", 
            string responseFile = null,
            string workingDirectory = null)
        {
            var io = new TestConsoleIO(input);

            var compiler = new CSharpInteractiveCompiler(
                responseFile,
                workingDirectory ?? AppContext.BaseDirectory,
                null,
                args ?? DefaultArgs,
                new NotImplementedAnalyzerLoader());

            return new CommandLineRunner(io, compiler, CSharpScriptCompiler.Instance, CSharpObjectFormatter.Instance);
        }
コード例 #6
0
        private static CommandLineRunner CreateRunner(
            string[] args = null,
            string input = "",
            string responseFile = null,
            string workingDirectory = null)
        {
            var io = new TestConsoleIO(input);
            var buildPaths = new BuildPaths(
                clientDir: AppContext.BaseDirectory,
                workingDir: workingDirectory ?? AppContext.BaseDirectory,
                sdkDir: null,
                tempDir: Path.GetTempPath());

            var compiler = new CSharpInteractiveCompiler(
                responseFile,
                buildPaths,
                args ?? s_defaultArgs,
                new NotImplementedAnalyzerLoader());

            return new CommandLineRunner(io, compiler, CSharpScriptCompiler.Instance, CSharpObjectFormatter.Instance);
        }