private async Task RemoveProjectByTarget(ModuleWithMastersInfo module, string moduleSolutionFile, NuGetPackageTarget target, bool isTieredProject) { var packages = module.NugetPackages.Where(n => (isTieredProject && n.TieredTarget != NuGetPackageTarget.Undefined ? n.TieredTarget : n.Target) == target ).ToList(); foreach (var package in packages) { if (target == NuGetPackageTarget.Web && package.Name.StartsWith("Volo.Abp.Account")) { continue; } await SolutionFileModifier.RemoveProjectFromSolutionFileAsync(moduleSolutionFile, package.Name); var projectPath = Path.Combine(Path.GetDirectoryName(moduleSolutionFile), "src", package.Name); if (Directory.Exists(projectPath)) { Directory.Delete(projectPath, true); } } }
public static string FindNuGetTargetProjectFile(string[] projectFiles, NuGetPackageTarget target) { if (!projectFiles.Any()) { return(null); } var assemblyNames = GetAssemblyNames(projectFiles); switch (target) { case NuGetPackageTarget.Web: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.IdentityServer: return(FindProjectEndsWith(projectFiles, assemblyNames, ".IdentityServer")); case NuGetPackageTarget.EntityFrameworkCore: return(FindProjectEndsWith(projectFiles, assemblyNames, ".EntityFrameworkCore")); case NuGetPackageTarget.MongoDB: return(FindProjectEndsWith(projectFiles, assemblyNames, ".MongoDB")); case NuGetPackageTarget.Application: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Application") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.ApplicationContracts: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Application.Contracts")); case NuGetPackageTarget.Domain: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Domain") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Application") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.DomainShared: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Domain.Shared")); case NuGetPackageTarget.HttpApi: return(FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi")); case NuGetPackageTarget.HttpApiClient: return(FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi.Client")); case NuGetPackageTarget.SignalR: return(FindProjectEndsWith(projectFiles, assemblyNames, ".SignalR") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Web") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi.Host")); case NuGetPackageTarget.Blazor: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Blazor")); default: return(null); } }
public static string FindNuGetTargetProjectFile(string[] projectFiles, NuGetPackageTarget target) { if (!projectFiles.Any()) { return(null); } var assemblyNames = GetAssemblyNames(projectFiles); switch (target) { case NuGetPackageTarget.Web: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.EntityFrameworkCore: return(FindProjectEndsWith(projectFiles, assemblyNames, ".EntityFrameworkCore")); case NuGetPackageTarget.MongoDB: return(FindProjectEndsWith(projectFiles, assemblyNames, ".MongoDB")); case NuGetPackageTarget.Application: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Application") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.ApplicationContracts: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Application.Contracts")); case NuGetPackageTarget.Domain: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Domain") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Application") ?? FindProjectEndsWith(projectFiles, assemblyNames, ".Web")); case NuGetPackageTarget.DomainShared: return(FindProjectEndsWith(projectFiles, assemblyNames, ".Domain.Shared")); case NuGetPackageTarget.HttpApi: return(FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi")); case NuGetPackageTarget.HttpApiClient: return(FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi.Client")); default: throw new ApplicationException($"{nameof(NuGetPackageTarget)}.{target} has not implemented!"); } }
private async Task <List <string> > FindProjectsToRemoveByTarget(ModuleWithMastersInfo module, NuGetPackageTarget target, bool isTieredProject) { var projectsToRemove = new List <string>(); var packages = module.NugetPackages.Where(n => (isTieredProject && n.TieredTarget != NuGetPackageTarget.Undefined ? n.TieredTarget : n.Target) == target ).ToList(); foreach (var package in packages) { if (target == NuGetPackageTarget.Web && package.Name.StartsWith("Volo.Abp.Account")) { continue; } projectsToRemove.Add(package.Name); } return(projectsToRemove); }