Exemple #1
0
 internal void AddPackageReference(NuGetPackage refPackage)
 {
     if (AllPackageReferences.Any(x => x == refPackage) ||
         PackageReferencesFromCsProj.Any(x => x == refPackage.Identity)
         )
     {
         throw new Exceptions.DuplicatePackageReferenceException($"Can't add {refPackage} as SlnX-package reference to the project {Name}, a reference to that package already exists");
     }
     _packageReferencesFromSlnx.Add(refPackage);
 }
Exemple #2
0
 private void AddPackageReferenceFromAssembly(NuGetPackage refPackage)
 {
     //Multiple assembly references might lead to the same package being referenced
     //Therefore AllPackageReferences should not be used here
     if (PackageReferencesFromCsProj.Any(x => x == refPackage.Identity) ||
         PackageReferencesFromSlnX.Any(x => x == refPackage))
     {
         throw new Exceptions.DuplicatePackageReferenceException($"Can't add {refPackage} as assembly-package reference to the project {Name}, a reference to that package already exists");
     }
     if (!_packageReferencesFromAssemblies.Contains(refPackage))
     {
         _packageReferencesFromAssemblies.Add(refPackage);
     }
 }