本文整理汇总了C#中IPackage.HasProjectContent方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.HasProjectContent方法的具体用法?C# IPackage.HasProjectContent怎么用?C# IPackage.HasProjectContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.HasProjectContent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPackage
public override void AddPackage(IPackage package)
{
base.AddPackage(package);
if (!package.HasProjectContent())
{
AddPackageReferenceEntry(package.Id, package.Version);
}
}
示例2: RemovePackage
public override void RemovePackage(IPackage package)
{
base.RemovePackage(package);
if (package.HasProjectContent())
{
_references.Remove(package.Id);
}
else
{
_solutionReferences.Remove(package.Id);
}
}
示例3: AddPackage
public override void AddPackage(IPackage package)
{
base.AddPackage(package);
if (package.HasProjectContent())
{
_references[package.Id] = package.Version;
}
else
{
_solutionReferences[package.Id] = package.Version;
}
}
示例4: IsSolutionLevel
private bool IsSolutionLevel(IPackage package)
{
// A package is solution level if
// - it doesn't have project content &
// - it doesn't have dependency on non solution-level package &
// - it is not referenced by any project.
if (package.HasProjectContent())
{
return false;
}
if (HasProjectLevelPackageDependency(package))
{
return false;
}
if (IsReferenced(package.Id, package.Version))
{
return false;
}
return true;
}
示例5: IsProjectLevel
/// <summary>
/// Check to see if this package applies to a project based on 2 criteria:
/// 1. The package has project content (i.e. content that can be applied to a project lib or content files)
/// 2. The package is referenced by any other project
/// 3. The package has at least one dependecy
///
/// This logic will probably fail in one edge case. If there is a meta package that applies to a project
/// that ended up not being installed in any of the projects and it only exists at solution level.
/// If this happens, then we think that the following operation applies to the solution instead of showing an error.
/// To solve that edge case we'd have to walk the graph to find out what the package applies to.
///
/// Technically, the third condition is not totally accurate because a solution-level package can depend on another
/// solution-level package. However, doing that check here is expensive and we haven't seen such a package.
/// This condition here is more geared towards guarding against metadata packages, i.e. we shouldn't treat metadata packages
/// as solution-level ones.
/// </summary>
public bool IsProjectLevel(IPackage package)
{
return package.HasProjectContent() ||
package.DependencySets.SelectMany(p => p.Dependencies).Any() ||
LocalRepository.IsReferenced(package.Id, package.Version);
}
示例6: GetPackageTarget
protected static PackageTargets GetPackageTarget(IPackage package)
{
IV3PackageMetadata v3package = package as IV3PackageMetadata;
if (v3package != null)
{
return v3package.PackageTarget;
}
else
{
if (package.HasProjectContent())
{
return PackageTargets.Project;
}
if (IsDependencyOnly(package))
{
return PackageTargets.None;
}
return PackageTargets.External;
}
}
示例7: IsSolutionLevel
private bool IsSolutionLevel(IPackage package)
{
// A package is solution level if it doesn't have project content & doesn't have dependency & not referenced by any project.
//
// Technically, the second condition is not totally accurate because a solution-level package can depend on another
// solution-level package. However, doing that check here is expensive and we haven't seen such a package.
// This condition here is more geared towards guarding against metadata packages, i.e. we shouldn't treat metadata packages
// as solution-level ones.
return !package.HasProjectContent() &&
!package.DependencySets.SelectMany(p => p.Dependencies).Any() &&
!IsReferenced(package.Id, package.Version);
}
示例8: IsProjectPackage
bool IsProjectPackage (IPackage package)
{
return package.HasProjectContent () ||
package.DependencySets.SelectMany (p => p.Dependencies).Any ();
}
示例9: GetPackageTarget
private static PackageTargets GetPackageTarget(IPackage package)
{
if (package.HasProjectContent())
{
return PackageTargets.Project;
}
if (IsDependencyOnly(package))
{
return PackageTargets.None;
}
return PackageTargets.External;
}
示例10: IsProjectLevel
/// <summary>
/// Check to see if this package applies to a project based on 2 criteria:
/// 1. The package has project content (i.e. content that can be applied to a project lib or content files)
/// 2. The package is referenced by any other project
///
/// This logic will probably fail in one edge case. If there is a meta package that applies to a project
/// that ended up not being installed in any of the projects and it only exists at solution level.
/// If this happens, then we think that the following operation applies to the solution instead of showing an error.
/// To solve that edge case we'd have to walk the graph to find out what the package applies to.
/// </summary>
public bool IsProjectLevel(IPackage package)
{
return package.HasProjectContent() || _sharedRepository.IsReferenced(package.Id, package.Version);
}