visual-studiomsbuildnuget-package-restore

Error occurred while restoring NuGet packages: "Invalid restore input. No target frameworks specified."


How to resolve Visual Studio (MSBuild) error message:

Error occurred while restoring NuGet packages: "Invalid restore input. No target frameworks specified."


Solution

  • The problem was caused by wrong project type specified in .sln file. In the solution file the project had type {D954291E-2A0B-460D-934E-DC6B0785DB48} (Shared Project / Windows Store App Universal).

    ...
    Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SomeProject", "SomeProject", "{...}"
    ...
    

    But actually the project is C# (SDK project). The problem was solved by changing the GUID/UUID in the solution file to the correct one, which is {9A19103F-16F7-4668-BE54-9A1E7A4F7556}.

    ...
    Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SomeProject", "SomeProject", "{...}"
    ...