本文整理汇总了C#中IPackage.IsReleaseVersion方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.IsReleaseVersion方法的具体用法?C# IPackage.IsReleaseVersion怎么用?C# IPackage.IsReleaseVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.IsReleaseVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetectUpgradeAction
private static PackageUpgradeAction DetectUpgradeAction(PackageDependency dependency, IPackage recentPackage)
{
var upgradeType = PackageUpgradeAction.None;
if (recentPackage == null)
{
upgradeType = PackageUpgradeAction.Unknown;
}
else if (dependency.VersionSpec.Satisfies(recentPackage.Version))
{
upgradeType = IsMinVersionUpgradeable(dependency, recentPackage)
? PackageUpgradeAction.MinVersion
: PackageUpgradeAction.None;
}
else
{
var fromRelease = DependsOnReleaseVersion(dependency);
if (recentPackage.IsReleaseVersion())
{
upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToRelease : PackageUpgradeAction.PrereleaseToRelease;
}
else
{
upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToPrerelease : PackageUpgradeAction.PrereleaseToPrerelease;
}
}
return upgradeType;
}
示例2: ConfigurePackageNode
private void ConfigurePackageNode(DirectedGraphNode node, IPackage package)
{
if (!package.IsReleaseVersion())
{
node.Background = _palette.PrereleaseColor;
}
}
示例3: PackageItem
public PackageItem(PackagesProviderBase provider, IPackage package, IEnumerable<Project> referenceProjectNames, bool isUpdateItem = false)
{
_provider = provider;
_packageIdentity = package;
_isUpdateItem = isUpdateItem;
_isPrerelease = !package.IsReleaseVersion();
_referenceProjectNames = new ObservableCollection<Project>(referenceProjectNames);
}
示例4: CreateUpdatePackageAction
UpdatePackageAction CreateUpdatePackageAction(IPackage package)
{
UpdatePackageAction action = CreateDefaultUpdatePackageAction(project);
action.PackageId = package.Id;
if (!action.AllowPrereleaseVersions && !package.IsReleaseVersion ()) {
action.AllowPrereleaseVersions = true;
}
return action;
}
示例5: PackageItem
public PackageItem(PackagesProviderBase provider, IPackage package, IEnumerable<Project> referenceProjectNames, SemanticVersion oldPackageVersion = null)
{
_provider = provider;
_packageIdentity = package;
_isUpdateItem = oldPackageVersion != null;
_oldPackageVersion = oldPackageVersion;
_isPrerelease = !package.IsReleaseVersion();
_referenceProjectNames = new ObservableCollection<Project>(referenceProjectNames);
}
示例6: AddPackageReference
public void AddPackageReference (IPackage package)
{
bool allowPrerelease = !package.IsReleaseVersion ();
bool ignoreDependencies = true;
packageManager.AddPackageReference (package, ignoreDependencies, allowPrerelease);
}
示例7: ReinstallPackageInProject
/// <summary>
/// Reinstall the specified package in the specified project, taking care of logging too.
/// </summary>
private void ReinstallPackageInProject(
IProjectManager projectManager,
IPackage package,
bool updateDependencies,
bool allowPrereleaseVersions,
ILogger logger)
{
logger = logger ?? NullLogger.Instance;
IDisposable disposableAction = StartReinstallOperation(package.Id, package.Version.ToString());
try
{
InitializeLogger(logger, projectManager);
logger.Log(MessageLevel.Info, VsResources.ReinstallProjectPackage, package, projectManager.Project.ProjectName);
// Before we start reinstalling, need to make sure the package exists in the source repository.
// Otherwise, the package will be uninstalled and can't be reinstalled.
if (SourceRepository.Exists(package))
{
RunSolutionAction(
() =>
{
UninstallPackage(
projectManager,
package.Id,
package.Version,
forceRemove: true,
removeDependencies: updateDependencies,
logger: logger);
InstallPackage(
projectManager,
package.Id,
package.Version,
ignoreDependencies: !updateDependencies,
allowPrereleaseVersions: allowPrereleaseVersions || !package.IsReleaseVersion(),
logger: logger);
});
}
else
{
logger.Log(
MessageLevel.Warning,
VsResources.PackageRestoreSkipForProject,
package.GetFullName(),
projectManager.Project.ProjectName);
}
}
finally
{
ClearLogger(projectManager);
disposableAction.Dispose();
}
}
示例8: ReinstallSolutionPackage
private void ReinstallSolutionPackage(
IPackage package,
bool updateDependencies,
bool allowPrereleaseVersions,
ILogger logger)
{
logger = logger ?? NullLogger.Instance;
var disposableAction = StartReinstallOperation(package.Id, package.Version.ToString());
try
{
InitializeLogger(logger);
logger.Log(MessageLevel.Info, VsResources.ReinstallSolutionPackage, package);
if (SourceRepository.Exists(package))
{
RunSolutionAction(
() =>
{
UninstallPackage(package, forceRemove: true, removeDependencies: !updateDependencies);
// Bug 2883: We must NOT use the overload that accepts 'package' object here,
// because after the UninstallPackage() call above, the package no longer exists.
InstallPackage(package.Id, package.Version, ignoreDependencies: !updateDependencies, allowPrereleaseVersions: allowPrereleaseVersions || !package.IsReleaseVersion());
});
}
else
{
logger.Log(
MessageLevel.Warning,
VsResources.PackageRestoreSkipForSolution,
package.GetFullName());
}
}
finally
{
ClearLogger();
disposableAction.Dispose();
}
}
示例9: CreateReinstallPackageAction
ReinstallPackageAction CreateReinstallPackageAction(IPackageManagementProject project, IPackage package)
{
ReinstallPackageAction action = project.CreateReinstallPackageAction();
action.PackageId = package.Id;
action.PackageVersion = package.Version;
action.UpdateDependencies = UpdateDependencies;
action.AllowPrereleaseVersions = AllowPreleaseVersions || !package.IsReleaseVersion();
action.PackageScriptRunner = this;
return action;
}
示例10: CreatePackageFromNuGetPackage
private Package CreatePackageFromNuGetPackage(PackageRegistration packageRegistration, IPackage nugetPackage)
{
var package = packageRegistration.Packages.SingleOrDefault(pv => pv.Version == nugetPackage.Version.ToString());
if (package != null)
{
throw new EntityException(
"A package with identifier '{0}' and version '{1}' already exists.", packageRegistration.Id, package.Version);
}
var now = DateTime.UtcNow;
var packageFileStream = nugetPackage.GetStream();
package = new Package
{
Version = nugetPackage.Version.ToString(),
Description = nugetPackage.Description,
ReleaseNotes = nugetPackage.ReleaseNotes,
RequiresLicenseAcceptance = nugetPackage.RequireLicenseAcceptance,
HashAlgorithm = Constants.Sha512HashAlgorithmId,
Hash = _cryptoService.GenerateHash(packageFileStream.ReadAllBytes()),
PackageFileSize = packageFileStream.Length,
Created = now,
Language = nugetPackage.Language,
LastUpdated = now,
Published = now,
Copyright = nugetPackage.Copyright,
IsPrerelease = !nugetPackage.IsReleaseVersion(),
Listed = true,
PackageRegistration = packageRegistration
};
if (nugetPackage.IconUrl != null)
{
package.IconUrl = nugetPackage.IconUrl.ToString();
}
if (nugetPackage.LicenseUrl != null)
{
package.LicenseUrl = nugetPackage.LicenseUrl.ToString();
}
if (nugetPackage.ProjectUrl != null)
{
package.ProjectUrl = nugetPackage.ProjectUrl.ToString();
}
if (nugetPackage.Summary != null)
{
package.Summary = nugetPackage.Summary;
}
if (nugetPackage.Tags != null)
{
package.Tags = nugetPackage.Tags;
}
if (nugetPackage.Title != null)
{
package.Title = nugetPackage.Title;
}
foreach (var author in nugetPackage.Authors)
{
package.Authors.Add(new PackageAuthor { Name = author });
}
var supportedFrameworks = GetSupportedFrameworks(nugetPackage).Select(fn => fn.ToShortNameOrNull()).ToArray();
if (!supportedFrameworks.AnySafe(sf => sf == null))
{
foreach (var supportedFramework in supportedFrameworks)
{
package.SupportedFrameworks.Add(new PackageFramework { TargetFramework = supportedFramework });
}
}
foreach (var dependencySet in nugetPackage.DependencySets)
{
if (dependencySet.Dependencies.Count == 0)
{
package.Dependencies.Add(
new PackageDependency
{
Id = null,
VersionSpec = null,
TargetFramework = dependencySet.TargetFramework.ToShortNameOrNull()
});
}
else
{
foreach (var dependency in dependencySet.Dependencies.Select(d => new { d.Id, d.VersionSpec, dependencySet.TargetFramework }))
{
package.Dependencies.Add(
new PackageDependency
{
Id = dependency.Id,
VersionSpec = dependency.VersionSpec == null ? null : dependency.VersionSpec.ToString(),
TargetFramework = dependency.TargetFramework.ToShortNameOrNull()
});
}
}
}
package.FlattenedAuthors = package.Authors.Flatten();
package.FlattenedDependencies = package.Dependencies.Flatten();
//.........这里部分代码省略.........
示例11: ReinstallSolutionPackage
private void ReinstallSolutionPackage(
IPackage package,
bool updateDependencies,
bool allowPrereleaseVersions,
ILogger logger)
{
logger = logger ?? NullLogger.Instance;
try
{
InitializeLogger(logger);
logger.Log(MessageLevel.Info, VsResources.ReinstallSolutionPackage, package);
if (SourceRepository.Exists(package))
{
RunSolutionAction(
() =>
{
UninstallPackage(package, forceRemove: true, removeDependencies: !updateDependencies);
InstallPackage(package, ignoreDependencies: !updateDependencies, allowPrereleaseVersions: allowPrereleaseVersions || !package.IsReleaseVersion());
});
}
else
{
logger.Log(
MessageLevel.Warning,
VsResources.PackageRestoreSkipForSolution,
package.GetFullName());
}
}
finally
{
ClearLogger();
}
}
示例12: AddPackageToCache
private void AddPackageToCache(ConcurrentDictionary<IPackage, DerivedPackageData> packages, ConcurrentDictionary<string, Tuple<IPackage, DerivedPackageData>> absoluteLatest, ConcurrentDictionary<string, Tuple<IPackage, DerivedPackageData>> latest, bool checkFrameworks, HttpContext context, string path, IPackage zip)
{
string packageHash = null;
long packageSize = 0;
string persistedHashFile = EnablePersistNupkgHash ? GetHashFile(path, false) : null;
bool hashComputeNeeded = true;
ReadHashFile(context, path, persistedHashFile, ref packageSize, ref packageHash, ref hashComputeNeeded);
if (hashComputeNeeded)
{
using (var stream = _fileSystem.OpenFile(path))
{
packageSize = stream.Length;
packageHash = Convert.ToBase64String(HashProvider.CalculateHash(stream));
}
WriteHashFile(context, path, persistedHashFile, packageSize, packageHash);
}
var data = new DerivedPackageData
{
PackageSize = packageSize,
PackageHash = packageHash,
LastUpdated = _fileSystem.GetLastModified(path),
Created = _fileSystem.GetCreated(path),
Path = path,
FullPath = _fileSystem.GetFullPath(path),
// default to false, these will be set later
IsAbsoluteLatestVersion = false,
IsLatestVersion = false
};
if (checkFrameworks)
{
data.SupportedFrameworks = zip.GetSupportedFrameworks();
}
var entry = new Tuple<IPackage, DerivedPackageData>(zip, data);
// find the latest versions
string id = zip.Id.ToLowerInvariant();
// update with the highest version
absoluteLatest.AddOrUpdate(id, entry, (oldId, oldEntry) => oldEntry.Item1.Version < entry.Item1.Version ? entry : oldEntry);
// update latest for release versions
if (zip.IsReleaseVersion())
{
latest.AddOrUpdate(id, entry, (oldId, oldEntry) => oldEntry.Item1.Version < entry.Item1.Version ? entry : oldEntry);
}
// add the package to the cache, it should not exist already
Debug.Assert(packages.ContainsKey(zip) == false, "duplicate package added");
packages.AddOrUpdate(zip, entry.Item2, (oldPkg, oldData) => oldData);
}
示例13: CreatePackageFromNuGetPackage
Package CreatePackageFromNuGetPackage(PackageRegistration packageRegistration, IPackage nugetPackage)
{
var package = packageRegistration.Packages
.Where(pv => pv.Version == nugetPackage.Version.ToString())
.SingleOrDefault();
if (package != null)
throw new EntityException("A package with identifier '{0}' and version '{1}' already exists.", packageRegistration.Id, package.Version);
var now = DateTime.UtcNow;
var packageFileStream = nugetPackage.GetStream();
package = new Package
{
Version = nugetPackage.Version.ToString(),
Description = nugetPackage.Description,
ReleaseNotes = nugetPackage.ReleaseNotes,
RequiresLicenseAcceptance = nugetPackage.RequireLicenseAcceptance,
HashAlgorithm = Constants.Sha512HashAlgorithmId,
Hash = cryptoSvc.GenerateHash(packageFileStream.ReadAllBytes()),
PackageFileSize = packageFileStream.Length,
Created = now,
Language = nugetPackage.Language,
LastUpdated = now,
Published = now,
Copyright = nugetPackage.Copyright,
IsPrerelease = !nugetPackage.IsReleaseVersion(),
Listed = true,
};
if (nugetPackage.IconUrl != null)
package.IconUrl = nugetPackage.IconUrl.ToString();
if (nugetPackage.LicenseUrl != null)
package.LicenseUrl = nugetPackage.LicenseUrl.ToString();
if (nugetPackage.ProjectUrl != null)
package.ProjectUrl = nugetPackage.ProjectUrl.ToString();
if (nugetPackage.Summary != null)
package.Summary = nugetPackage.Summary;
if (nugetPackage.Tags != null)
package.Tags = nugetPackage.Tags;
if (nugetPackage.Title != null)
package.Title = nugetPackage.Title;
foreach (var author in nugetPackage.Authors)
package.Authors.Add(new PackageAuthor { Name = author });
var supportedFrameworks = GetSupportedFrameworks(nugetPackage).Select(fn => fn.ToShortNameOrNull()).ToArray();
if (!supportedFrameworks.AnySafe(sf => sf == null))
foreach (var supportedFramework in supportedFrameworks)
package.SupportedFrameworks.Add(new PackageFramework { TargetFramework = supportedFramework });
foreach (var dependencySet in nugetPackage.DependencySets)
{
if (dependencySet.Dependencies.Count == 0)
package.Dependencies.Add(new PackageDependency
{
Id = null,
VersionSpec = null,
TargetFramework = dependencySet.TargetFramework.ToShortNameOrNull()
});
else
foreach (var dependency in dependencySet.Dependencies.Select(d => new { d.Id, d.VersionSpec, dependencySet.TargetFramework }))
package.Dependencies.Add(new PackageDependency
{
Id = dependency.Id,
VersionSpec = dependency.VersionSpec == null ? null : dependency.VersionSpec.ToString(),
TargetFramework = dependency.TargetFramework.ToShortNameOrNull()
});
}
foreach (var packageFile in nugetPackage.GetFiles().OrEmptyListIfNull())
{
var filePath = packageFile.Path;
var fileContent = " ";
IList<string> extensions = new List<string>();
var approvedExtensions = Configuration.ReadAppSettings("PackageFileTextExtensions");
if (!string.IsNullOrWhiteSpace(approvedExtensions))
{
foreach (var extension in approvedExtensions.Split(',', ';'))
{
extensions.Add("." + extension);
}
}
try
{
if (extensions.Contains(Path.GetExtension(filePath)))
{
fileContent = packageFile.GetStream().ReadToEnd();
}
}
catch (Exception ex)
{
// Log but swallow the exception
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
}
package.Files.Add(new PackageFile
{
//.........这里部分代码省略.........
示例14: CreatePackageFromNuGetPackage
Package CreatePackageFromNuGetPackage(PackageRegistration packageRegistration, IPackage nugetPackage)
{
var package = packageRegistration.Packages
.Where(pv => pv.Version == nugetPackage.Version.ToString())
.SingleOrDefault();
if (package != null)
throw new EntityException("A package with identifier '{0}' and version '{1}' already exists.", packageRegistration.Id, package.Version);
// TODO: add flattened authors, and other properties
// TODO: add package size
var now = DateTime.UtcNow;
var packageFileStream = nugetPackage.GetStream();
package = new Package
{
Version = nugetPackage.Version.ToString(),
Description = nugetPackage.Description,
ReleaseNotes = nugetPackage.ReleaseNotes,
RequiresLicenseAcceptance = nugetPackage.RequireLicenseAcceptance,
HashAlgorithm = Constants.Sha512HashAlgorithmId,
Hash = cryptoSvc.GenerateHash(packageFileStream.ReadAllBytes()),
PackageFileSize = packageFileStream.Length,
Created = now,
LastUpdated = now,
Published = now,
Copyright = nugetPackage.Copyright,
IsPrerelease = !nugetPackage.IsReleaseVersion(),
Listed = true
};
if (nugetPackage.IconUrl != null)
package.IconUrl = nugetPackage.IconUrl.ToString();
if (nugetPackage.LicenseUrl != null)
package.LicenseUrl = nugetPackage.LicenseUrl.ToString();
if (nugetPackage.ProjectUrl != null)
package.ProjectUrl = nugetPackage.ProjectUrl.ToString();
if (nugetPackage.Summary != null)
package.Summary = nugetPackage.Summary;
if (nugetPackage.Tags != null)
package.Tags = nugetPackage.Tags;
if (nugetPackage.Title != null)
package.Title = nugetPackage.Title;
foreach (var author in nugetPackage.Authors)
package.Authors.Add(new PackageAuthor { Name = author });
foreach (var dependency in nugetPackage.Dependencies)
package.Dependencies.Add(new PackageDependency { Id = dependency.Id, VersionSpec = dependency.VersionSpec.ToStringSafe() });
package.FlattenedAuthors = package.Authors.Flatten();
package.FlattenedDependencies = package.Dependencies.Flatten();
return package;
}
示例15: ReinstallPackageInProject
/// <summary>
/// Reinstall the specified package in the specified project, taking care of logging too.
/// </summary>
private void ReinstallPackageInProject(
IProjectManager projectManager,
IPackage package,
bool updateDependencies,
bool allowPrereleaseVersions,
ILogger logger)
{
logger = logger ?? NullLogger.Instance;
try
{
InitializeLogger(logger, projectManager);
logger.Log(MessageLevel.Info, VsResources.ReinstallProjectPackage, package, projectManager.Project.ProjectName);
RunSolutionAction(
() =>
{
UninstallPackage(
projectManager,
package.Id,
package.Version,
forceRemove: true,
removeDependencies: updateDependencies,
logger: logger);
InstallPackage(
projectManager,
package.Id,
package.Version,
ignoreDependencies: !updateDependencies,
allowPrereleaseVersions: allowPrereleaseVersions || !package.IsReleaseVersion(),
logger: logger);
});
}
finally
{
ClearLogger(projectManager);
}
}