Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred while restoring NuGet packages: The operation failed as details for project ClassLibrary1 could not be loaded. #8813

Closed
paiden opened this issue Nov 13, 2019 · 1 comment
Labels

Comments

@paiden
Copy link

paiden commented Nov 13, 2019

Details about Problem

Open attached solution in Visual Studio
and try to compile it. It will create an error message during build
'Error occurred while restoring NuGet packages: The operation failed
as details for project ClassLibrary1 could not be loaded.'

The reason is that it has two targets and a assembly name that changes
depending on target version. This causes an InvalidOperationException
in VsNominationUtilities ~Line 300:
GetNonEvaluatedPropertyOrNull(values, propertyName, valueFactory).SingleOrDefault()
that is invoked by
internal static string GetPackageId(ProjectNames projectNames, IEnumerable tfms)
as two package ID's are resolved (one for each assembly name).

This further causes that no restore entry is created in the project
system cache and then will cause this build error.

  • NuGet product used: Visual Studio build with package restore enabled
  • Worked before? If so, with which NuGet version: Don't think so.
  • VS version (if appropriate): Version 16.4.0 Preview 4.0

Detailed repro steps so we can see the same problem

  1. Open attached solution in Visual Studio
  2. build
  3. See build output

Other suggested things

A workaround is to set an explicit 'PackageId' for ClassLibrary1.
But it took me one day of debugging the NuGet extension to find that IMO workaround.

So some fix, or at least better log output when the cache entry cannot be created would
be nice. If i saw correctly, the exception during cache creation is simply swallowed
(at least in normal builds without special logging enabled etc.) and
and creates followup issues later. Very annoying.

Sample Project

ConsoleApp27.zip

@nkolev92
Copy link
Member

Thanks for filing this.
Duplicate of #8456.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants