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

Inconsistency between LSL and non-LSL restore when a project reference is framework incompatible #5777

Closed
nkolev92 opened this issue Aug 18, 2017 · 3 comments
Assignees
Milestone

Comments

@nkolev92
Copy link
Member

nkolev92 commented Aug 18, 2017

The setup is the following:
A net45 Project.json project references a net46 Legacy Package Ref project.
Attached repro solution.
Included in the root directory of the solution is project.lock file

Solution_a381.zip

Lock file latest dev lsl mode.

{
  "version": 3,
  "targets": {
    ".NETFramework,Version=v4.5": {
      "NuGet.Versioning/1.0.7": {
        "type": "package",
        "compile": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        },
        "runtime": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        }
      },
      "PackageReferenceClassLibrary_6ee6/1.0.0": {
        "type": "project",
        "framework": "Unsupported,Version=v0.0",
        "dependencies": {
          "NuGet.Versioning": "1.0.7"
        }
      }
    },
    ".NETFramework,Version=v4.5/win": {
      "NuGet.Versioning/1.0.7": {
        "type": "package",
        "compile": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        },
        "runtime": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        }
      },
      "PackageReferenceClassLibrary_6ee6/1.0.0": {
        "type": "project",
        "framework": "Unsupported,Version=v0.0",
        "dependencies": {
          "NuGet.Versioning": "1.0.7"
        }
      }
    },
    ".NETFramework,Version=v4.5/win-anycpu": {
      "NuGet.Versioning/1.0.7": {
        "type": "package",
        "compile": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        },
        "runtime": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        }
      },
      "PackageReferenceClassLibrary_6ee6/1.0.0": {
        "type": "project",
        "framework": "Unsupported,Version=v0.0",
        "dependencies": {
          "NuGet.Versioning": "1.0.7"
        }
      }
    },
    ".NETFramework,Version=v4.5/win-x86": {
      "NuGet.Versioning/1.0.7": {
        "type": "package",
        "compile": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        },
        "runtime": {
          "lib/portable-net40+win/NuGet.Versioning.dll": {}
        }
      },
      "PackageReferenceClassLibrary_6ee6/1.0.0": {
        "type": "project",
        "framework": "Unsupported,Version=v0.0",
        "dependencies": {
          "NuGet.Versioning": "1.0.7"
        }
      }
    }
  },
  "libraries": {
    "NuGet.Versioning/1.0.7": {
      "sha512": "NTiuXbF1wNSSSahdmLGFwrpVbGgUq1tNoLVgWsI7iWNF4Hv98JTi/kTfZbP0vMKNfv6GtuV77jnfb3hcEymcTQ==",
      "type": "package",
      "path": "nuget.versioning/1.0.7",
      "files": [
        "lib/portable-net40+win/NuGet.Versioning.XML",
        "lib/portable-net40+win/NuGet.Versioning.dll",
        "nuget.versioning.1.0.7.nupkg.sha512",
        "nuget.versioning.nuspec"
      ]
    },
    "PackageReferenceClassLibrary_6ee6/1.0.0": {
      "type": "project",
      "path": "../PackageReferenceClassLibrary_6ee6/PackageReferenceClassLibrary_6ee6.csproj",
      "msbuildProject": "../PackageReferenceClassLibrary_6ee6/PackageReferenceClassLibrary_6ee6.csproj"
    }
  },
  "projectFileDependencyGroups": {
    "": [],
    ".NETFramework,Version=v4.5": []
  },
  "packageFolders": {
    "C:\\Users\\nikolev.REDMOND\\.nuget\\packages\\": {}
  },
  "project": {
    "restore": {
      "projectUniqueName": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\BuildIntegratedClassLibrary_a16c.csproj",
      "projectName": "BuildIntegratedClassLibrary_a16c",
      "projectPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\BuildIntegratedClassLibrary_a16c.csproj",
      "projectJsonPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\project.json",
      "packagesPath": "C:\\Users\\nikolev.REDMOND\\.nuget\\packages\\",
      "outputPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\obj\\",
      "projectStyle": "ProjectJson",
      "configFilePaths": [
        "C:\\Users\\nikolev.REDMOND\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "sources": {
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "C:\\Users\\nikolev.REDMOND\\.dotnet\\NuGetFallbackFolder": {},
        "D:\\BLAAA": {},
        "https://api.nuget.org/v3/index.json": {},
        "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json": {}
      },
      "frameworks": {
        "net45": {
          "projectReferences": {
            "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\PackageReferenceClassLibrary_6ee6\\PackageReferenceClassLibrary_6ee6.csproj": {
              "projectPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\PackageReferenceClassLibrary_6ee6\\PackageReferenceClassLibrary_6ee6.csproj"
            }
          }
        }
      }
    },
    "frameworks": {
      "net45": {}
    },
    "runtimes": {
      "win": {
        "#import": []
      },
      "win-anycpu": {
        "#import": []
      },
      "win-x86": {
        "#import": []
      }
    }
  },
  "logs": [
    {
      "code": "NU1201",
      "level": "Error",
      "message": "Project PackageReferenceClassLibrary_6ee6 is not compatible with net45 (.NETFramework,Version=v4.5). Project PackageReferenceClassLibrary_6ee6 supports: net46 (.NETFramework,Version=v4.6)",
      "libraryId": "PackageReferenceClassLibrary_6ee6",
      "targetGraphs": [
        ".NETFramework,Version=v4.5"
      ]
    },
    {
      "code": "NU1201",
      "level": "Error",
      "message": "Project PackageReferenceClassLibrary_6ee6 is not compatible with net45 (.NETFramework,Version=v4.5) / win. Project PackageReferenceClassLibrary_6ee6 supports: net46 (.NETFramework,Version=v4.6)",
      "libraryId": "PackageReferenceClassLibrary_6ee6",
      "targetGraphs": [
        ".NETFramework,Version=v4.5/win"
      ]
    },
    {
      "code": "NU1201",
      "level": "Error",
      "message": "Project PackageReferenceClassLibrary_6ee6 is not compatible with net45 (.NETFramework,Version=v4.5) / win-anycpu. Project PackageReferenceClassLibrary_6ee6 supports: net46 (.NETFramework,Version=v4.6)",
      "libraryId": "PackageReferenceClassLibrary_6ee6",
      "targetGraphs": [
        ".NETFramework,Version=v4.5/win-anycpu"
      ]
    },
    {
      "code": "NU1201",
      "level": "Error",
      "message": "Project PackageReferenceClassLibrary_6ee6 is not compatible with net45 (.NETFramework,Version=v4.5) / win-x86. Project PackageReferenceClassLibrary_6ee6 supports: net46 (.NETFramework,Version=v4.6)",
      "libraryId": "PackageReferenceClassLibrary_6ee6",
      "targetGraphs": [
        ".NETFramework,Version=v4.5/win-x86"
      ]
    }
  ]
}

Latest dev non-lsl mode

{
  "version": 3,
  "targets": {
    ".NETFramework,Version=v4.5": {},
    ".NETFramework,Version=v4.5/win": {},
    ".NETFramework,Version=v4.5/win-anycpu": {},
    ".NETFramework,Version=v4.5/win-x86": {}
  },
  "libraries": {},
  "projectFileDependencyGroups": {
    "": [],
    ".NETFramework,Version=v4.5": []
  },
  "packageFolders": {
    "C:\\Users\\nikolev.REDMOND\\.nuget\\packages\\": {}
  },
  "project": {
    "restore": {
      "projectUniqueName": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\BuildIntegratedClassLibrary_a16c.csproj",
      "projectName": "BuildIntegratedClassLibrary_a16c",
      "projectPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\BuildIntegratedClassLibrary_a16c.csproj",
      "projectJsonPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\project.json",
      "packagesPath": "C:\\Users\\nikolev.REDMOND\\.nuget\\packages\\",
      "outputPath": "C:\\Users\\nikolev.REDMOND\\Desktop\\Solution_a381\\BuildIntegratedClassLibrary_a16c\\obj\\",
      "projectStyle": "ProjectJson",
      "configFilePaths": [
        "C:\\Users\\nikolev.REDMOND\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "sources": {
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "C:\\Users\\nikolev.REDMOND\\.dotnet\\NuGetFallbackFolder": {},
        "D:\\BLAAA": {},
        "https://api.nuget.org/v3/index.json": {},
        "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json": {}
      }
    },
    "frameworks": {
      "net45": {}
    },
    "runtimes": {
      "win": {
        "#import": []
      },
      "win-anycpu": {
        "#import": []
      },
      "win-x86": {
        "#import": []
      }
    }
  }
}

The 15.3 behavior is like the non-LSL one for both cases, however someone seemed to suggest this might not be the right thing.

We need to clarify the correct behavior here in general and add tests to verify that all works we think it does/should

@nkolev92 nkolev92 added Priority:1 High priority issues that must be resolved in the current sprint. Functionality:Restore Lightweight solution load labels Aug 18, 2017
@nkolev92
Copy link
Member Author

nkolev92 commented Aug 18, 2017

While looking into figuring out the issue here, I've noticed that dg specs are different in the LSL and non-LSL mode.
The non-LSL one the 15.3 behavior and imho it should stay that way.
The zip file contain both dgs.
Investigating why the dg specs are different.
nuget-dg.zip

@nkolev92
Copy link
Member Author

nkolev92 commented Aug 18, 2017

@zhili1208 zhili1208 self-assigned this Aug 22, 2017
@zhili1208 zhili1208 added ClosedAs:WontFix and removed Priority:1 High priority issues that must be resolved in the current sprint. labels Sep 7, 2017
@zhili1208
Copy link
Contributor

it's risky to change PC and PJ behavior and LSL did right thing to throw error, close it as won't fix

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

No branches or pull requests

2 participants