2

Closed

Check and auto-update HintPath in .csproj file

description

It would be nice if the NuGet update command would check and fix HintPath references in the VS project file.

Please see SO question for details: http://stackoverflow.com/questions/6444226/can-i-avoid-checking-in-the-bin-folder-of-mvc3-project-with-nuget
Closed Jul 12, 2011 at 10:12 PM by Haacked
Resolving as won't fix as fixing up hint paths when you move a project (which seems like a somewhat rare thing) is out of scope for NuGet.

You could reinstall all your packages as one workaround.

comments

mteper wrote Jan 9, 2012 at 7:35 PM

Why would this be out of scope of NuGet VS integration? Sure, it may be rare, and perhaps not a high priority, but out of scope?

WorldMaker wrote Sep 24, 2012 at 4:51 PM

I agree with mteper. I don't understand why this is marked out of scope: the point of NuGet is to help manage references. The HintPath is a rather important part of reference management. Visual Studio seems somewhat prone to accidentally forgetting HintPath, and there are many a case of a bad TFS auto-merge I've seen, that causes VS to revert to GAC-installed binaries, particularly for things like MVC3 and WIF that have been on the slow migration path from GAC-install to NuGet. Plus there's the use case of trying to clean up old solutions where things relied on GAC-installed references and it would be great if NuGet helped with that rather than the current behavior of "Solution already has a reference to x, skipping" due to the GAC reference.

At the very least, IMO, NuGet should warn when a HintPath for an installed NuGet package (ie, in packages.config) does not match the expected Packages directory, even if it doesn't offer to correct it.

elloyd wrote Oct 25, 2012 at 7:56 PM

This situation just came around and bit me -- we've migrated our repositoryPath to a new location outside the tree, and now we have to go through and fix up eleven projects. There should at least be a Refresh command available in the VS integration to accommodate the situation.

pranavkm wrote Oct 25, 2012 at 9:59 PM

@elloyd - Update-Package -Reinstall should do this for you.

msumerano wrote Jul 24, 2013 at 11:02 PM

The other issue is that the HintPath, regardless of what is set in NuGet.config for repositoryPath, uses relative paths. So, in NuGet.config, we have "C:\temp_NuGetPackageCache" set as our repositoryPath. However, the HintPath in the projects look something like "..........\temp_NuGetPackageCache" as they end up being relative to the location of the csproj file.

If each dev does not have the exact folder structure where code is pulled into from VCS, then each dev is constantly dealing with broken builds due to missing references.

I'm not sure that's anything that NuGet can deal with. "Update-Package -reinstall" is at least a quick fix, but HintPaths get committed to source control, and we're constantly fighting it due to relative paths.