public void AddDependency(string id, string version) { NugetPackageIdentifier[] current = Dependencies; NugetPackageIdentifier[] next = new NugetPackageIdentifier[current.Length + 1]; current.CopyTo(next, 0); next[next.Length - 1] = new NugetPackageIdentifier(id, version); Dependencies = next; }
/// <summary> /// Adds a dependency. Will not add the dependency if the specified id /// is already a dependency regardless of version, use UpdateDependencyVersion /// in that case. /// </summary> /// <param name="id">The identifier.</param> /// <param name="version">The version.</param> public void AddDependency(string id, string version) { NugetPackageIdentifier[] current = Dependencies.Where(npi => !npi.Id.Equals(id)).ToArray(); NugetPackageIdentifier[] next = new NugetPackageIdentifier[current.Length + 1]; current.CopyTo(next, 0); next[next.Length - 1] = new NugetPackageIdentifier(id, version); Dependencies = next; }