Exemple #1
0
        private static void LogFailedTargets(string projectFile, BuildResult result)
        {
            if (_log.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error))
            {
                var failedTargetsEnum = result
                                        .ResultsByTarget
                                        .Where(p => p.Value.ResultCode == TargetResultCode.Failure)

                                        // CoreCompile will most likely fail, particularly if it depends
                                        // on generated code to compile.
                                        .Where(p => p.Key != "CoreCompile")
                                        .Select(p => p.Value);

                if (failedTargetsEnum.Any())
                {
                    var failedTargets = string.Join("; ", failedTargetsEnum);

                    _log.Error(
                        $"Failed to analyze project file [{projectFile}], the targets [{failedTargets}] failed to execute." +
                        "This may be due to an invalid path, such as $(SolutionDir) being used in the csproj; try using relative paths instead." +
                        "This may also be related to a missing default configuration directive. Refer to the Uno.SourceGenerator Readme.md file for more details."
                        );
                }
            }
        }