public static bool IsReferenceFromPackage(this ProjectReference projectReference) { if (!projectReference.IsAssemblyReference()) { return(false); } var project = projectReference.OwnerProject as DotNetProject; if ((project == null) || !project.HasPackages()) { return(false); } var assemblyFilePath = new FilePath(projectReference.GetFullAssemblyPath()); if (assemblyFilePath.IsNullOrEmpty) { return(false); } var packagesPath = new SolutionPackageRepositoryPath(project); var packagesFilePath = new FilePath(packagesPath.PackageRepositoryPath); return(assemblyFilePath.IsChildPathOf(packagesFilePath)); }
public static bool IsReferenceFromPackage(this ProjectReference projectReference) { if (!projectReference.IsAssemblyReference()) { return(false); } var project = projectReference.OwnerProject as DotNetProject; if (project == null) { return(false); } var assemblyFilePath = new FilePath(projectReference.GetFullAssemblyPath()); if (assemblyFilePath.IsNullOrEmpty) { return(false); } FilePath packagesFolderPath = project.GetPackagesFolderPath(); return(assemblyFilePath.IsChildPathOf(packagesFolderPath)); }