Skip to content

Commit

Permalink
Improve failed project reference item
Browse files Browse the repository at this point in the history
This message can occur when any item in a project fails to resolve and Visual Studio DTE is unable to return it. This is a problem if the item is a project reference, but the rest of the time it does not impact NuGet. Based on the current feedback this message is appearing much more frequently and leading users to believe that there was a restore error when there was not.

The intent of the actual message is just to inform users that if they do see missing packages that it could have been caused by a broken project reference.

The fix for this is to move the message from warning to verbose. If a user does hit the rare scenario of getting an incomplete restore they can debug it by increasing their verbosity and reading the new, more helpful, message.

Fixes NuGet/Home#3955
  • Loading branch information
emgarten committed Dec 28, 2016
1 parent a2ea65d commit e1b9369
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/NuGet.Clients/PackageManagement.VisualStudio/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@
<data name="Warning_FailedToMarkPackageDirectoryForDeletion" xml:space="preserve">
<value>Failed to mark package directory '{0}' for deletion on Visual Studio restart: {1}</value>
</data>
<data name="Warning_ErrorDuringProjectClosureWalk" xml:space="preserve">
<value>Failed to resolve all project references. The package restore result for '{0}' or a dependent project may be incomplete.</value>
<data name="UnresolvedItemDuringProjectClosureWalk" xml:space="preserve">
<value>Failed to resolve all items referenced by '{0}'. This message can typically be ignored. The issue may be resolved by fully restoring and building the solution. If the unresolved item is a project reference this can lead to an incomplete NuGet restore result and missing package references. To ensure that restore is able to find all projects verify that all projects are referenced correctly and exist on disk.</value>
</data>
<data name="SolutionIsNotSaved" xml:space="preserve">
<value>Solution is not saved. Please save your solution before managing NuGet packages.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,15 @@ public static async Task<IReadOnlyList<ProjectRestoreReference>> GetDirectProjec
if (hasMissingReferences)
{
// Log a warning message once per project
// This warning contains only the names of the root project and the project with the
// broken reference. Attempting to display more details on the actual reference
// that has the problem may lead to another exception being thrown.
var warning = string.Format(
// Log a generic message once per project if any items could not be resolved.
// In most cases this can be ignored, but in the rare case where the unresolved
// item is actually a project the restore result will be incomplete.
var message = string.Format(
CultureInfo.CurrentCulture,
Strings.Warning_ErrorDuringProjectClosureWalk,
Strings.UnresolvedItemDuringProjectClosureWalk,
EnvDTEProjectUtility.GetUniqueName(project));
log.LogWarning(warning);
log.LogVerbose(message);
}
return results;
Expand Down

0 comments on commit e1b9369

Please sign in to comment.