Example #1
0
        public IResult <IReadOnlyCollection <ITaskItem> > Execute()
        {
            _processInfoDumper.DumpProcessInfo();
            _taskLoggingWrapper.LogMessage("Starting GenerateFeatureFileCodeBehind");

            var xrmFrameworkProject = _xrmFrameworkProjectProvider.GetXrmFrameworkProject();

            using (var generatorContainer = _wrappedGeneratorContainerBuilder.BuildGeneratorContainer(
                       xrmFrameworkProject.ProjectSettings.ConfigurationHolder,
                       xrmFrameworkProject.ProjectSettings,
                       _xrmFrameworkProjectInfo.GeneratorPlugins,
                       _rootObjectContainer))
            {
                var projectCodeBehindGenerator = generatorContainer.Resolve <IProjectCodeBehindGenerator>();

                try
                {
                    _ = Task.Run(_msbuildTaskAnalyticsTransmitter.TryTransmitProjectCompilingEventAsync);

                    var returnValue = projectCodeBehindGenerator.GenerateCodeBehindFilesForProject();

                    if (_taskLoggingWrapper.HasLoggedErrors())
                    {
                        return(Result <IReadOnlyCollection <ITaskItem> > .Failure("Feature file code-behind generation has failed with errors."));
                    }

                    return(Result.Success(returnValue));
                }
                catch (Exception e)
                {
                    _exceptionTaskLogger.LogException(e);
                    return(Result <IReadOnlyCollection <ITaskItem> > .Failure(e));
                }
            }
        }
Example #2
0
        public void DumpProcessInfo()
        {
            try
            {
                var currentProcess = Process.GetCurrentProcess();

                _taskLoggingWrapper.LogMessage($"process: {currentProcess.ProcessName}, pid: {currentProcess.Id}, CD: {Environment.CurrentDirectory}");

                foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    _taskLoggingWrapper.LogMessage($"  {assembly.FullName}");
                }
            }
            catch (Exception e)
            {
                _taskLoggingWrapper.LogMessage($"Error when dumping process info: {e}");
            }
        }
Example #3
0
        public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            _taskLoggingWrapper.LogMessage(args.Name);

            return(null);
        }