Browse Source

Update ProjectNugetPackageAdder.cs

pull/8187/head
Yunus Emre Kalkan 6 years ago
parent
commit
5bbe63e1a4
  1. 14
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs

14
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs

@ -83,6 +83,11 @@ namespace Volo.Abp.Cli.ProjectModification
bool withSourceCode = false,
bool addSourceCodeToSolutionFile = false)
{
if (version == null)
{
version = GetAbpVersionOrNull(projectFile);
}
await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall);
if (withSourceCode)
@ -204,11 +209,6 @@ namespace Volo.Abp.Cli.ProjectModification
return;
}
if (version == null)
{
version = GetAbpVersionOrNull(projectFileContent);
}
using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile)))
{
Logger.LogInformation(
@ -301,8 +301,10 @@ namespace Volo.Abp.Cli.ProjectModification
return Task.CompletedTask;
}
private string GetAbpVersionOrNull(string projectFileContent)
private string GetAbpVersionOrNull(string projectFile)
{
var projectFileContent = File.ReadAllText(projectFile);
var doc = new XmlDocument() {PreserveWhitespace = true};
doc.Load(StreamHelper.GenerateStreamFromString(projectFileContent));

Loading…
Cancel
Save