NuGet.VersionUtility.GetFrameworkString C# (CSharp) Method

GetFrameworkString() public static method

public static GetFrameworkString ( FrameworkName frameworkName ) : string
frameworkName FrameworkName
return string
        public static string GetFrameworkString(FrameworkName frameworkName)
        {
            string name = frameworkName.Identifier + frameworkName.Version;
            if (String.IsNullOrEmpty(frameworkName.Profile))
            {
                return name;
            }
            return name + "-" + frameworkName.Profile;
        }

Usage Example

        public override void AddPackage(IPackage package)
        {
            if (PackageSaveMode.HasFlag(PackageSaveModes.Nuspec))
            {
                // Starting from 2.1, we save the nuspec file into the subdirectory with the name as <packageId>.<version>
                // for example, for jQuery version 1.0, it will be "jQuery.1.0\\jQuery.1.0.nuspec"
                string   packageFilePath = GetManifestFilePath(package.Id, package.Version);
                Manifest manifest        = Manifest.Create(package);

                // The IPackage object doesn't carry the References information.
                // Thus we set the References for the manifest to the set of all valid assembly references
                manifest.Metadata.ReferenceSets = package.AssemblyReferences
                                                  .GroupBy(f => f.TargetFramework)
                                                  .Select(
                    g => new ManifestReferenceSet
                {
                    TargetFramework = g.Key == null ? null : VersionUtility.GetFrameworkString(g.Key),
                    References      = g.Select(p => new ManifestReference {
                        File = p.Name
                    }).ToList()
                })
                                                  .ToList();

                FileSystem.AddFileWithCheck(packageFilePath, manifest.Save);
            }

            if (PackageSaveMode.HasFlag(PackageSaveModes.Nupkg))
            {
                string packageFilePath = GetPackageFilePath(package);

                FileSystem.AddFileWithCheck(packageFilePath, package.GetStream);
            }
        }
All Usage Examples Of NuGet.VersionUtility::GetFrameworkString