Repository navigation
Use "PackageReferences" to determine applicability - #3618
Conversation
|
@NuGet/nuget-client What's the trick to building this locally? I've tried following https://github.com/NuGet/NuGet.Client/blob/dev/CONTRIBUTING.md#build and I get the following running Configure: Have no issue hitting that URL locally. |
|
I also have a HttpClient test program: https://gist.github.com/zivkan/5291f507c8c5724d41a18357b7afcd30. You'll need to change the csproj to test net5.0 if that's the SDK you have installed and are using for restore. NuGet just uses HttpClient. We don't change the SslProtocol defaults, so we're dependent on the operating system working (well, NuGet's dependant on the .NET runtime working, but the System.Net.Http team say they just use the OS defaults). It's frustrating that so many people on WIndows have been having TLS connection problems, but I don't remember any problems from customers on Linux or Mac. Anyway, if my test program says that "none" failed, then your operating system defaults need to be changed. |
| return hierarchy.IsCapabilityMatch("AssemblyReferences + DeclaredSourceItems + UserSourceItems"); | ||
| // NOTE: (AssemblyReferences + DeclaredSourceItems + UserSourceItems) exists solely for compatibility reasons | ||
| // with existing custom CPS-based projects that existed before "PackageReferences" capability was introduced. | ||
| return hierarchy.IsCapabilityMatch("(AssemblyReferences + DeclaredSourceItems + UserSourceItems) | PackageReferences"); |
There was a problem hiding this comment.
We have another capability check, see here.
That one probably needs to be a PackageReferences check but I think it can break some custom project-systems if any.
There was a problem hiding this comment.
I think this is good enough for now though.
Happy to have a discussion if necessary @davkean
|
@zivkan fwiw, seems like this is a Framework instead of Core problem: NuGet/Home#9961 At least afaik, the configure.ps1 script calls MSBuild, |
|
@zivkan I tried turning on TLS 1.3 via some regkeys I fond on the interweb, but to no avail - what should I be setting it? |
|
@rrelyea It looks like some tests with your photo next to it, timed out, should I be looking at those? |
Windows TLS 1.3 should be disabled, not enabled. My understanding is that the TLS 1.3 implementation that Windows had months ago was from an early TLS1.3 spec that got changed before the rest of the industry took up TLS1.3, so Windows TLS APIs were never really compatible with TLS1.3. But it had always been turned off by default, possibly until recently. The dotnet/runtime issue I linked suggests that recent Windows Insider builds have changed something, in case you're running preview versions of Windows. Check that thread out for more info, but again people reported that disabling TLS 1.3 allows .NET's HttpClient to use TLS1.2. The strangest thing is that nuget.org told their CDN provider to turn off TLS 1.3 on api.nuget.org, which suggests that Windows TLS implementation isn't even "falling back" to TLS 1.2 when both 1.3 and 1.2 are enabled on the client, but the server only supports 1.2 More than this, I'm not really sure. NuGet uses .NET's HttpClient in a fairly standard way, so we're reliant on the .NET System.Net team, and the Windows SCHANNEL team (they implement TLS). All I can suggest is contacting those teams. My gist that I linked is a very simple demo app to ensure that it's not NuGet doing something weird.
We've been experiencing a lot of xunit flakiness, but only on Linux. Each time Linux tests hang, there's exactly 8 tests that started and never finished, but the tests seem to be different each time, so we haven't been able to determine it's the way that a test was implemented, and if it was one specific test, it doesn't explain why it kills 7 other tests in the run. Anyway, I'll rerun the failed linux job. Most of the time the tests don't hang, but a non-trivial percentage do hang. We'll see how lucky we are today. |
|
Thank you for the fix. Could you please fill out the PR template? |
aortiz-msft
left a comment
There was a problem hiding this comment.
Please fill out the PR template.
donnie-msft
left a comment
There was a problem hiding this comment.
Please link to any docs/specs that describe the PackageReferences capability.
It's possible that we are not bucketing the project in the right Specifically here: If you are motivated, you can debug and see in which bucket it ends up. We have 2 types of PR projects, LegacyPackageReference and NetCorePackageReferenceProject. |
I think only restore might "just work". Installing, upgrading and uninstalling packages, NuGet has a hard dependency on the project system currently, so I don't think it will work for projects that are neither csproj.dll or CPS (although it's not clear to me if it would even work for non-.NET CPS projects, maybe our updates are specific to managed CPS project types). |
The checks for "can I read PRs" & "can I write PRs" are rolled into one (the whole ProjectProvider concept) so I think we just don't interpret them as PR at the end of the day. |
Fixes: NuGet/Home#9957
Fix
Restore uses a variety of things to opt projects into restore operations. One is a list of hardcoded project types "guids", and the other is a set of project capabilities. Across VS we're moved away from hardcoding project types to capabilities as a better way of representing the set of features a given project supports. In the past before "PackageReferences" existed, NuGet used the presence of
AssemblyReferences + DeclaredSourceItems + UserSourceItemas indicator that a project supports restore. Since then we've added a new capability;PackageReferences. CPS-based package-related features have been tied behind it, including the code that nominates for restore, and watches the project assets file for changes. This code can be found here: https://github.com/dotnet/project-system/tree/master/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/PackageRestore.This change lets a custom CPS-based project type, including C++ and MSIX projects to opt into the PackageReferences capability and have end-to-end just work.
Testing/Validation
Tests Added: No
Reason for not adding tests: There is no obvious way to test this in the code base.
Validation:
I've verified that this doesn't break existing restore for existing projects. Only two project types are currently using
PackageReferencesproject capability and both already definedAssemblyReferences + DeclaredSourceItems + UserSourceItem, so this change by itself does not opt anymore projects into restore without corresponding project system changes.I've verified in a custom project type (based on CPS) that this "lights" up Package Manager support including restore, and package manager. It does not, however, cause the assets file to be written whcih needs investigation. I think we should enable this anyway, as it lets us iterate with MSIX/C++ without needing custom builds of NuGet.