Ejemplo n.º 1
0
        /// <summary>
        /// Since we log that we weren't able to connect to the task host in a couple of different places,
        /// extract it out into a separate method.
        /// </summary>
        private void LogErrorUnableToCreateTaskHost(TaskHostContext requiredContext, string runtime, string architecture, NodeFailedToLaunchException e)
        {
            string msbuildLocation = NodeProviderOutOfProcTaskHost.GetMSBuildLocationFromHostContext(requiredContext);

            if (msbuildLocation == null)
            {
                // We don't know the path -- probably we're trying to get a 64-bit assembly on a
                // 32-bit machine.  At least give them the exe name to look for, though ...
                switch (requiredContext)
                {
                case TaskHostContext.X32CLR2:
                case TaskHostContext.X64CLR2:
                    msbuildLocation = "MSBuildTaskHost.exe";
                    break;

                case TaskHostContext.X32CLR4:
                case TaskHostContext.X64CLR4:
                    msbuildLocation = "MSBuild.exe";
                    break;

                case TaskHostContext.Invalid:
                default:
                    ErrorUtilities.ThrowInternalErrorUnreachable();
                    break;
                }
            }

            if (e == null)
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostAcquireFailed", _taskType.Type.Name, runtime, architecture, msbuildLocation);
            }
            else
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostNodeFailedToLaunch", _taskType.Type.Name, runtime, architecture, msbuildLocation, e.ErrorCode, e.Message);
            }
        }
Ejemplo n.º 2
0
        private void LogErrorUnableToCreateTaskHost(HandshakeOptions requiredContext, string runtime, string architecture, NodeFailedToLaunchException e)
        {
            string msbuildLocation = NodeProviderOutOfProcTaskHost.GetMSBuildLocationFromHostContext(requiredContext) ??
                                     // We don't know the path -- probably we're trying to get a 64-bit assembly on a
                                     // 32-bit machine.  At least give them the exe name to look for, though ...
                                     ((requiredContext & HandshakeOptions.CLR2) == HandshakeOptions.CLR2 ? "MSBuildTaskHost.exe" : "MSBuild.exe");

            if (e == null)
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostAcquireFailed", _taskType.Type.Name, runtime, architecture, msbuildLocation);
            }
            else
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostNodeFailedToLaunch", _taskType.Type.Name, runtime, architecture, msbuildLocation, e.ErrorCode, e.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Since we log that we weren't able to connect to the task host in a couple of different places,
        /// extract it out into a separate method. 
        /// </summary>
        private void LogErrorUnableToCreateTaskHost(TaskHostContext requiredContext, string runtime, string architecture, NodeFailedToLaunchException e)
        {
            string msbuildLocation = NodeProviderOutOfProcTaskHost.GetMSBuildLocationFromHostContext(requiredContext);

            if (msbuildLocation == null)
            {
                // We don't know the path -- probably we're trying to get a 64-bit assembly on a 
                // 32-bit machine.  At least give them the exe name to look for, though ...
                switch (requiredContext)
                {
                    case TaskHostContext.X32CLR2:
                    case TaskHostContext.X64CLR2:
                        msbuildLocation = "MSBuildTaskHost.exe";
                        break;
                    case TaskHostContext.X32CLR4:
                    case TaskHostContext.X64CLR4:
                        msbuildLocation = "MSBuild.exe";
                        break;
                    case TaskHostContext.Invalid:
                    default:
                        ErrorUtilities.ThrowInternalErrorUnreachable();
                        break;
                }
            }

            if (e == null)
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostAcquireFailed", _taskType.Type.Name, runtime, architecture, msbuildLocation);
            }
            else
            {
                _taskLoggingContext.LogError(new BuildEventFileInfo(_taskLocation), "TaskHostNodeFailedToLaunch", _taskType.Type.Name, runtime, architecture, msbuildLocation, e.ErrorCode, e.Message);
            }
        }