public async Task AddAsync( string projectFile, NugetPackageInfo package, string version = null, bool useDotnetCliToInstall = true, bool withSourceCode = false, bool addSourceCodeToSolutionFile = false) { if (version == null) { version = GetAbpVersionOrNull(projectFile); } await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall); if (withSourceCode) { await AddSourceCode(projectFile, package, version); await ConvertPackageReferenceToProjectReference(projectFile, package); if (addSourceCodeToSolutionFile) { await SolutionFileModifier.AddPackageToSolutionFileAsync(package, FindSolutionFile(projectFile)); } } }
public async Task AddAsync( string solutionFile, string projectFile, NugetPackageInfo package, string version = null, bool useDotnetCliToInstall = true, bool withSourceCode = false, bool addSourceCodeToSolutionFile = false) { if (projectFile == null) { if (solutionFile == null) { throw new CliUsageException("Couldn't find any project/solution."); } projectFile = GetProjectFile(solutionFile, package); if (projectFile == null) { throw new CliUsageException("Couldn't find any project/solution."); } } solutionFile ??= FindSolutionFile(projectFile); if (version == null) { version = GetAbpVersionOrNull(projectFile); } await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall); if (withSourceCode) { await AddSourceCode(projectFile, solutionFile, package, version); var projectFilesInSolution = Directory.GetFiles(Path.GetDirectoryName(solutionFile), "*.csproj", SearchOption.AllDirectories); foreach (var projectFileInSolution in projectFilesInSolution) { await ConvertPackageReferenceToProjectReference(projectFileInSolution, solutionFile, package); } if (addSourceCodeToSolutionFile) { await SolutionFileModifier.AddPackageToSolutionFileAsync(package, solutionFile); } } }
public async Task AddAsync( string solutionFile, string projectFile, NugetPackageInfo package, string version = null, bool useDotnetCliToInstall = true, bool withSourceCode = false, bool addSourceCodeToSolutionFile = false) { if (projectFile == null) { if (solutionFile == null) { throw new CliUsageException("Couldn't find any project/solution."); } projectFile = GetProjectFile(solutionFile, package); if (projectFile == null) { throw new CliUsageException("Couldn't find any project/solution."); } } solutionFile ??= FindSolutionFile(projectFile); if (version == null) { version = GetAbpVersionOrNull(projectFile); } await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall); if (withSourceCode) { await AddSourceCode(projectFile, solutionFile, package, version); await ConvertPackageReferenceToProjectReference(projectFile, solutionFile, package); if (addSourceCodeToSolutionFile) { await SolutionFileModifier.AddPackageToSolutionFileAsync(package, solutionFile); } } }