Skip to content

Commit

Permalink
fix indentation and existing package references lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pragnya17 authored and Pragnya Pandrate committed Jul 5, 2022
1 parent 2d5c9e4 commit 991539a
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,15 @@ private void AddPackageReference(Project project,
}
else
{
if (!existingPackageReferences.Any())
{
//Add <PackageReference/> to the project file.
AddPackageReferenceIntoItemGroupCPM(project, itemGroup, libraryDependency);
}

// Get package version if it already exists in the props file. Returns null if there is no matching package version.
ProjectItem packageVersionInProps = project.Items.LastOrDefault(i => i.ItemType == PACKAGE_VERSION_TYPE_TAG && i.EvaluatedInclude.Equals(libraryDependency.Name));

//Add <PackageReference/> to the project file.
AddPackageReferenceIntoItemGroupCPM(project, itemGroup, libraryDependency);

// If no <PackageVersion /> exists in the Directory.Packages.props file.
if (packageVersionInProps == null)
{
Expand Down Expand Up @@ -263,11 +266,7 @@ private void AddPackageVersionIntoPropsItemGroup(Project project, ProjectItemGro
var item = itemGroup.AddItem(PACKAGE_VERSION_TYPE_TAG, libraryDependency.Name);
var packageVersion = AddVersionMetadata(libraryDependency, item);
AddExtraMetadataToProjectItemElement(libraryDependency, item);
Logger.LogInformation(string.Format(CultureInfo.CurrentCulture,
Strings.Info_AddPkgAdded,
libraryDependency.Name,
packageVersion,
itemGroup.ContainingProject.FullPath
Logger.LogInformation(string.Format(CultureInfo.CurrentCulture, Strings.Info_AddPkgAdded, libraryDependency.Name, packageVersion, itemGroup.ContainingProject.FullPath
));
}

Expand Down

0 comments on commit 991539a

Please sign in to comment.