示例#1
0
        internal static int CreateAndRunServer(
            string pipeName,
            string tempPath,
            IClientConnectionHost clientConnectionHost = null,
            IDiagnosticListener listener        = null,
            TimeSpan?keepAlive                  = null,
            NameValueCollection appSettings     = null,
            CancellationToken cancellationToken = default)
        {
            appSettings ??= new NameValueCollection();
            var controller = new BuildServerController(appSettings);

            return(controller.RunServer(pipeName, tempPath, clientConnectionHost, listener, keepAlive, cancellationToken));
        }
示例#2
0
        internal static int CreateAndRunServer(
            string pipeName,
            ICompilerServerHost?compilerServerHost     = null,
            IClientConnectionHost?clientConnectionHost = null,
            IDiagnosticListener?listener        = null,
            TimeSpan?keepAlive                  = null,
            NameValueCollection?appSettings     = null,
            ICompilerServerLogger?logger        = null,
            CancellationToken cancellationToken = default)
        {
            appSettings ??= new NameValueCollection();
            logger ??= EmptyCompilerServerLogger.Instance;
            var controller = new BuildServerController(appSettings, logger);

            return(controller.RunServer(pipeName, compilerServerHost, clientConnectionHost, listener, keepAlive, cancellationToken));
        }
示例#3
0
        public static int Main(string[] args)
        {
            NameValueCollection appSettings;

            try
            {
#if BOOTSTRAP
                ExitingTraceListener.Install();
#endif

#if NET472
                appSettings = System.Configuration.ConfigurationManager.AppSettings;
#else
                // Do not use AppSettings on non-desktop platforms
                appSettings = new NameValueCollection();
#endif
            }
            catch (Exception ex)
            {
                // It is possible for AppSettings to throw when the application or machine configuration
                // is corrupted.  This should not prevent the server from starting, but instead just revert
                // to the default configuration.
                appSettings = new NameValueCollection();
                CompilerServerLogger.LogException(ex, "Error loading application settings");
            }

            try
            {
                var controller = new BuildServerController(appSettings);
                return(controller.Run(args));
            }
            catch (FileNotFoundException e)
            {
                // Assume the exception was the result of a missing compiler assembly.
                LogException(e);
            }
            catch (TypeInitializationException e) when(e.InnerException is FileNotFoundException)
            {
                // Assume the exception was the result of a missing compiler assembly.
                LogException((FileNotFoundException)e.InnerException);
            }
            return(CommonCompiler.Failed);
        }