Ejemplo n.º 1
0
        internal AssemblyInfoProperties(PropertyGroupCollection propertyGroupCollection)
        {
            if (propertyGroupCollection == null)
            {
                throw new ArgumentNullException(nameof(propertyGroupCollection));
            }

            _company              = new Lazy <string>(() => propertyGroupCollection.GetElementValue("Company"));
            _configuration        = new Lazy <string>(() => propertyGroupCollection.GetElementValue("Configuration"));
            _copyright            = new Lazy <string>(() => propertyGroupCollection.GetElementValue("Copyright"));
            _description          = new Lazy <string>(() => propertyGroupCollection.GetElementValue("Description"));
            _fileVersion          = new Lazy <string>(() => propertyGroupCollection.GetElementValue("FileVersion"));
            _informationalVersion = new Lazy <string>(() => propertyGroupCollection.GetElementValue("InformationalVersion"));
            _product              = new Lazy <string>(() => propertyGroupCollection.GetElementValue("Product"));
            _assemblyTitle        = new Lazy <string>(() => propertyGroupCollection.GetElementValue("AssemblyTitle"));
            _assemblyVersion      = new Lazy <string>(() => propertyGroupCollection.GetElementValue("AssemblyVersion"));
            _neutralLanguage      = new Lazy <string>(() => propertyGroupCollection.GetElementValue("NeutralLanguage"));
        }
        internal NugetMetaDataProperties(PropertyGroupCollection propertyGroups)
        {
            if (propertyGroups == null)
            {
                throw new ArgumentNullException(nameof(propertyGroups));
            }

            _isPackable         = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IsPackable", true));
            _packageVersion     = new Lazy <string>(() => propertyGroups.GetElementValue("PackageVersion"));
            _packageId          = new Lazy <string>(() => propertyGroups.GetElementValue("PackageId"));
            _title              = new Lazy <string>(() => propertyGroups.GetElementValue("Title"));
            _authors            = new Lazy <IEnumerable <string> >(() => propertyGroups.GetElementValue("Authors").SplitOnSemiColon());
            _packageDescription = new Lazy <string>(() => propertyGroups.GetElementValue("PackageDescription"));
            _description        = new Lazy <string>(() => propertyGroups.GetElementValue("Description"));

            _includeSymbols       = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IncludeSymbols"));
            _includeSource        = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IncludeSource"));
            _isTool               = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IsTool"));
            _noPackageAnalysis    = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("NoPackageAnalysis"));
            _includeBuildOutput   = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IncludeBuildOutput"));
            _includeContentInPack = new Lazy <bool>(() => propertyGroups.GetElementBoolValue("IncludeContentInPack", true));

            _packageTags          = new Lazy <IEnumerable <string> >(() => propertyGroups.GetElementValue("PackageTags").SplitOnCommaOrSpace());
            _contentTargetFolders = new Lazy <IEnumerable <string> >(() =>
            {
                var value = propertyGroups.GetElementValue("ContentTargetFolders");

                return(string.IsNullOrEmpty(value) ? ContentTargetFoldersDefaultValue.SplitOnSemiColon() : value.SplitOnSemiColon());
            });

            _nuspecFile       = new Lazy <string>(() => propertyGroups.GetElementValue("NuspecFile"));
            _nuspecBasePath   = new Lazy <string>(() => propertyGroups.GetElementValue("NuspecBasePath"));
            _nuspecProperties = new Lazy <Dictionary <string, string> >(() =>
            {
                var nameValues = propertyGroups.GetElementValue("NuspecProperties").SplitOnSemiColon();

                return(nameValues
                       .Select(nameValue => nameValue.Split('='))
                       .ToDictionary(pair => pair[0], pair => pair[1]));
            });

            _minClientVersion        = new Lazy <string>(() => propertyGroups.GetElementValue("MinClientVersion"));
            _buildOutputTargetFolder = new Lazy <string>(() => propertyGroups.GetElementValue("BuildOutputTargetFolder"));

            _packageRequireLicenseAcceptance = new Lazy <bool>(() => Convert.ToBoolean(propertyGroups.GetElementValue("PackageRequireLicenseAcceptance")));
            _packageLicenseExpression        = new Lazy <string>(() => propertyGroups.GetElementValue("PackageLicenseExpression"));
            _packageOutputPath   = new Lazy <string>(() => propertyGroups.GetElementValue("PackageOutputPath"));
            _symbolPackageFormat = new Lazy <string>(() => propertyGroups.GetElementValue("SymbolPackageFormat"));

            _packageLicenseFile  = new Lazy <string>(() => propertyGroups.GetElementValue("PackageLicenseFile"));
            _packageLicenseUrl   = new Lazy <string>(() => propertyGroups.GetElementValue("PackageLicenseUrl"));
            _packageIconUrl      = new Lazy <string>(() => propertyGroups.GetElementValue("PackageIconUrl"));
            _repositoryUrl       = new Lazy <string>(() => propertyGroups.GetElementValue("RepositoryUrl"));
            _repositoryType      = new Lazy <string>(() => propertyGroups.GetElementValue("RepositoryType"));
            _packageReleaseNotes = new Lazy <string>(() => propertyGroups.GetElementValue("PackageReleaseNotes"));
            _copyright           = new Lazy <string>(() => propertyGroups.GetElementValue("Copyright"));
        }