NuGet.VersionUtility.GetShortFrameworkName C# (CSharp) Метод

GetShortFrameworkName() публичный статический Метод

public static GetShortFrameworkName ( FrameworkName frameworkName ) : string
frameworkName FrameworkName
Результат string
        public static string GetShortFrameworkName(FrameworkName frameworkName)
        {
            string name;
            if (!_identifierToFrameworkFolder.TryGetValue(frameworkName.Identifier, out name))
            {
                name = frameworkName.Identifier;
            }

            // only show version part if it's > 0.0.0.0
            if (frameworkName.Version > new Version())
            {
                // Remove the . from versions
                name += frameworkName.Version.ToString().Replace(".", String.Empty);
            }

            if (String.IsNullOrEmpty(frameworkName.Profile))
            {
                return name;
            }

            string profile;
            if (!_identifierToProfileFolder.TryGetValue(frameworkName.Profile, out profile))
            {
                profile = frameworkName.Profile;
            }

            return name + "-" + profile;
        }

Usage Example

Пример #1
0
        private void AddEntry(XDocument document, string id, SemanticVersion version, FrameworkName targetFramework)
        {
            XElement element = FindEntry(document, id, version);

            if (element != null)
            {
                element.Remove();
            }

            var newElement = new XElement("package",
                                          new XAttribute("id", id),
                                          new XAttribute("version", version));

            if (targetFramework != null)
            {
                newElement.Add(new XAttribute("targetFramework", VersionUtility.GetShortFrameworkName(targetFramework)));
            }

            // Restore the version constraint
            string versionConstraint;

            if (_constraints.TryGetValue(id, out versionConstraint))
            {
                newElement.Add(new XAttribute("allowedVersions", versionConstraint));
            }

            document.Root.Add(newElement);

            SaveDocument(document);
        }
All Usage Examples Of NuGet.VersionUtility::GetShortFrameworkName