Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoSuter committed Oct 6, 2017
1 parent 9778f0e commit b51a810
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 57 deletions.
25 changes: 0 additions & 25 deletions src/NuGetReferenceSwitcher.Presentation/Models/ProjectModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ public bool AddReference(string assemblyPath)
if (File.Exists(assemblyPath))
{
var reference = _vsProject.References.Add(assemblyPath) as Reference4;

if (reference != null)
{
reference.SpecificVersion = true;
}

return true;
}
Expand Down Expand Up @@ -169,27 +166,5 @@ private void LoadReferences()
NuGetReferences.Add(reference);
}
}

public void FixUpNuGetReferences()
{
XDocument xDoc = XDocument.Load(Path);

XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003";

var itemGroup = xDoc.Root?.Elements(ns + "ItemGroup").Where(x => x.Elements(ns + "Reference").Any()).FirstOrDefault();

if (itemGroup != null)
{
foreach (XElement reference in itemGroup.Elements(ns + "Reference").Where(x => x.Elements(ns + "HintPath").Any()))
{
foreach (XElement version in reference.Elements(ns + "SpecificVersion"))
{
version.Remove();
}
}
}

//xDoc.Save(Path);
}
}
}
64 changes: 32 additions & 32 deletions src/NuGetReferenceSwitcher.Presentation/Models/Reference4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@

namespace NuGetReferenceSwitcher.Presentation.Models
{
[Guid("F71B6036-80F1-4F08-BC59-B5D92865F629")]
[Guid("F71B6036-80F1-4F08-BC59-B5D92865F629")]
public interface Reference4
{
// Reference
[DispId(1)] DTE DTE { get; }
[DispId(1)] DTE DTE { get; }
[DispId(2)] References Collection { get; }
[DispId(3)] Project ContainingProject { get; }
[DispId(4)] void Remove();
[DispId(5)] string Name { get; }
[DispId(6)] prjReferenceType Type { get; }
[DispId(7)] string Identity { get; }
[DispId(8)] string Path { get; }
[DispId(9)] string Description { get; }
[DispId(10)] string Culture { get; }
[DispId(11)] int MajorVersion { get; }
[DispId(12)] int MinorVersion { get; }
[DispId(13)] int RevisionNumber { get; }
[DispId(14)] int BuildNumber { get; }
[DispId(15)] bool StrongName { get; }
[DispId(16)] Project SourceProject { get; }
[DispId(17)] bool CopyLocal { get; set; }
[DispId(18), TypeLibFunc(1088)] dynamic get_Extender(string ExtenderName);
[DispId(19)] dynamic ExtenderNames { get; }
[DispId(20)] string ExtenderCATID { get; }
[DispId(21)] string PublicKeyToken { get; }
[DispId(22)] string Version { get; }
// Reference2
[DispId(100)] string RuntimeVersion { get; }
// Reference3
[DispId(120)] bool SpecificVersion { get; set; } // The property we actually need
[DispId(121)] string SubType { get; set; }
[DispId(122)] bool Isolated { get; set; }
[DispId(123)] string Aliases { get; set; }
[DispId(124)] uint RefType { get; }
[DispId(125)] bool AutoReferenced { get; }
[DispId(126)] bool Resolved { get; }
// Reference4
[DispId(127)] bool EmbedInteropTypes { get; set; }
}
[DispId(6)] prjReferenceType Type { get; }
[DispId(7)] string Identity { get; }
[DispId(8)] string Path { get; }
[DispId(9)] string Description { get; }
[DispId(10)] string Culture { get; }
[DispId(11)] int MajorVersion { get; }
[DispId(12)] int MinorVersion { get; }
[DispId(13)] int RevisionNumber { get; }
[DispId(14)] int BuildNumber { get; }
[DispId(15)] bool StrongName { get; }
[DispId(16)] Project SourceProject { get; }
[DispId(17)] bool CopyLocal { get; set; }
[DispId(18), TypeLibFunc(1088)] dynamic get_Extender(string ExtenderName);
[DispId(19)] dynamic ExtenderNames { get; }
[DispId(20)] string ExtenderCATID { get; }
[DispId(21)] string PublicKeyToken { get; }
[DispId(22)] string Version { get; }
// Reference2
[DispId(100)] string RuntimeVersion { get; }
// Reference3
[DispId(120)] bool SpecificVersion { get; set; } // The property we actually need
[DispId(121)] string SubType { get; set; }
[DispId(122)] bool Isolated { get; set; }
[DispId(123)] string Aliases { get; set; }
[DispId(124)] uint RefType { get; }
[DispId(125)] bool AutoReferenced { get; }
[DispId(126)] bool Resolved { get; }
// Reference4
[DispId(127)] bool EmbedInteropTypes { get; set; }
}
}

0 comments on commit b51a810

Please sign in to comment.