Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Now works with NuGet 2.2

Fixes #9. NuGet changed the way it looks for packages in a repository in 2.2. It now uses IPackageLookup, rather than just finding any packages in the repo's directory. It was previously finding the package by luck - we were passing in the package directory, not the repo directory.
  • Loading branch information...
commit fc7c90073bea97d232f8460c44dec26a5d54342a 1 parent 7467caa
@citizenmatt citizenmatt authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/resharper-nuget/NuGetApi.cs
View
12 src/resharper-nuget/NuGetApi.cs
@@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using EnvDTE;
using JetBrains.Application;
using JetBrains.Application.Components;
@@ -100,11 +101,12 @@ private string DoInstallAssemblyAsNuGetPackage(IEnumerable<FileSystemPath> assem
if (metadata == null)
return null;
- // Passing in the package's install path and a null version is enough for NuGet to install the existing
- // package into the current project
- // TODO: Need to add some error handling here. What can go wrong?
- vsPackageInstaller.InstallPackage(metadata.InstallPath, vsProject, metadata.Id, (Version) null, false);
-
+ // We need to get the repository path from the installed package. Sadly, this means knowing that
+ // the package is installed one directory below the repository. Just a small crack in the black box.
+ // (We can pass "All" as the package source, rather than the repository path, but that would give
+ // us an aggregate of the current package sources, rather than using the local repo as a source)
+ var repositoryPath = Path.GetDirectoryName(metadata.InstallPath);
+ vsPackageInstaller.InstallPackage(repositoryPath, vsProject, metadata.Id, (Version)null, false);
return metadata.InstallPath;
}
Please sign in to comment.
Something went wrong with that request. Please try again.