Beispiel #1
0
        public static DependencyDescription Create(LibraryDescription library,
                                                   List <DiagnosticMessage> diagnostics,
                                                   IDictionary <string, LibraryExport> exportsLookup)
        {
            var result = new DependencyDescription
            {
                Name         = library.Identity.Name,
                DisplayName  = library.Identity.Name,
                Version      = (library.Identity.Version ?? new NuGetVersion("1.0.0")).ToNormalizedString(),
                Type         = library.Identity.Type.Value,
                Resolved     = library.Resolved,
                Path         = library.Path,
                Dependencies = library.Dependencies.Select(dependency => GetDependencyItem(dependency, exportsLookup)),
                Errors       = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Error)
                               .Select(d => new DiagnosticMessageView(d)),
                Warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning)
                           .Select(d => new DiagnosticMessageView(d))
            };

            var msbuildLibrary = library as MSBuildProjectDescription;

            if (msbuildLibrary != null)
            {
                result.Path = msbuildLibrary.MSBuildProjectPath;
            }

            return(result);
        }
        public static DependencyDescription Create(LibraryDescription library,
                                                   List<DiagnosticMessage> diagnostics,
                                                   IDictionary<string, LibraryExport> exportsLookup)
        {
            var result = new DependencyDescription
            {
                Name = library.Identity.Name,
                DisplayName = library.Identity.Name,
                Version = library.Identity.Version?.ToNormalizedString(),
                Type = library.Identity.Type.Value,
                Resolved = library.Resolved,
                Path = library.Path,
                Dependencies = library.Dependencies.Select(dependency => GetDependencyItem(dependency, exportsLookup)),
                Errors = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Error)
                                    .Select(d => new DiagnosticMessageView(d)),
                Warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning)
                                      .Select(d => new DiagnosticMessageView(d))
            };

            var msbuildLibrary = library as MSBuildProjectDescription;
            if (msbuildLibrary != null)
            {
                result.Path = msbuildLibrary.MSBuildProjectPath;
            }

            return result;
        }