public static bool CanRestorePackages(this DotNetProject project) { var nugetAwareProject = project as INuGetAwareProject; if (nugetAwareProject != null) { return(nugetAwareProject.HasPackages()); } return(HasPackages(project.BaseDirectory, project.Name) || DotNetCoreNuGetProject.CanCreate(project) || PackageReferenceNuGetProject.CanCreate(project)); }
protected override Task <TargetEvaluationResult> OnRunTarget(ProgressMonitor monitor, string target, ConfigurationSelector configuration, TargetEvaluationContext context) { if (Project is DotNetProject dotNetProject && IsCoreCompileDependsOn(target, context)) { if (DotNetCoreNuGetProject.CanCreate(dotNetProject)) { return(OnRunDotNetCoreProjectTarget(monitor, target, configuration, context)); } else if (PackageReferenceNuGetProject.CanCreate(dotNetProject)) { return(OnRunPackageReferenceProjectTarget(monitor, target, configuration, context)); } } return(base.OnRunTarget(monitor, target, configuration, context)); }
void ProjectTargetFrameworkChanged(object sender, ProjectTargetFrameworkChangedEventArgs e) { if (e.Project.HasPackagesConfig()) { var runner = new PackageCompatibilityRunner(e.Project); runner.Run(); } else if (DotNetCoreNuGetProject.CanCreate(e.Project.DotNetProject)) { // Ignore - .NET Core project target framework changes are handled // by the DotNetCoreProjectExtension. } else if (PackageReferenceNuGetProject.CanCreate(e.Project.DotNetProject)) { RestorePackagesInProjectHandler.Run(e.Project.DotNetProject); } }