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

nuget.client: build for .NET 5 #1828

Closed
wants to merge 1 commit into from
Closed

Conversation

tmds
Copy link
Member

@tmds tmds commented Oct 22, 2020

Use built version for System.Security.{Cryptography.Pkcs,ProtectedData,ProtectedData}

cc @dagood @crummel @dseefeld @omajid

@tmds
Copy link
Member Author

tmds commented Oct 22, 2020

The build fails. A class is not found:

/src/artifacts/src/NuGet.Client.3501ddedc274ac10d4b135856b7593a6bb8a72f1/src/NuGet.Core/NuGet.Packaging/Signing/Cms/ICms.cs(20,55): error CS0246: The type or namespace name 'CngKey' could not be found (are you missing a using directive or an assembly reference?) [/src/artifacts/src/NuGet.Client.3501ddedc274ac10d4b135856b7593a6bb8a72f1/src/NuGet.Core/NuGet.Packaging/NuGet.Packaging.csproj]

Maybe the wrong tfm gets used:

/src/artifacts/src/NuGet.Client.3501ddedc274ac10d4b135856b7593a6bb8a72f1/src/NuGet.Core/NuGet.Commands/NuGet.Commands.csproj : warning NU1701: Package 'System.Security.Cryptography.Cng 5.0.0-rc.1.20451.14' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. [/src/artifacts/src/NuGet.Client.3501ddedc274ac10d4b135856b7593a6bb8a72f1/build/restorehelper.targets]

@dagood
Copy link
Member

dagood commented Oct 22, 2020

Hmm. Here are the binlogs from the build if needed: NuGet.Client.3501ddedc274ac10d4b135856b7593a6bb8a72f1.zip

I think @crummel and @dseefeld have more recent experience here, with targetframework meddling...

@tmds
Copy link
Member Author

tmds commented Oct 23, 2020

I'm not sure how to tackle this further.

@dagood
Copy link
Member

dagood commented Oct 23, 2020

Looking at an rc1-based source-build I have, I see these in System.Security.Cryptography.Cng.5.0.0-rc.1.20451.14.nupkg lib/:

...
net461
net462
net47
net5.0
netcoreapp3.0
netstandard2.1
...

In Microsoft-built system.security.cryptography.cng.5.0.0-rc.1.20451.14.nupkg lib/:

...
net46
net461
net462
net47
netcoreapp2.1
netcoreapp3.0
netstandard1.3
netstandard1.4
netstandard1.6
netstandard2.0
netstandard2.1
...

Since this NuGet project is targeting .NETStandard,Version=v2.0/netstandard2.0, it's not able to find any match in the source-built nupkg and falls back to net[something], which apparently isn't working.

I think dotnet/runtime might be using package harvesting to get netstandard2.0 into the package, which we can't do. @dseefeld has done some investigation in #1798 on this general problem (no details posted yet). No clear way forward at the moment from the dotnet/runtime side.

Moving NuGet forward to netstandard2.1 or even net5.0 might be a way forward. But we haven't yet documented why we need to do this in certain cases: #1763. @dseefeld @crummel is this reasonable?

@tmds
Copy link
Member Author

tmds commented Oct 24, 2020

Looking at an rc1-based source-build I have, I see these in System.Security.Cryptography.Cng.5.0.0-rc.1.20451.14.nupkg lib/:

@dagood these packages get built from runtime repo, right? Is it by one of these build commands? Do you know which? I haven't tried figure it out.

+echo "Running command: $scriptroot/build.sh $commonArgs -subset clr.tools+clr.runtime+clr.corelib+clr.nativecorelib+clr.packages $coreclrArgs $additionalArgs"
+$scriptroot/build.sh $commonArgs -subset clr.tools+clr.runtime+clr.corelib+clr.nativecorelib+clr.packages $coreclrArgs $additionalArgs
+find $scriptroot/artifacts/ -type f -name Build.binlog -exec rename "Build.binlog" "coreclrBuild.binlog" * {} \;
+ilasmPath=$(dirname $(find $scriptroot/artifacts/bin -name ilasm))
+echo "Running command: $scriptroot/build.sh $commonArgs -subset libs $librariesArgs /p:ILAsmToolPath=$ilasmPath $additionalArgs"
+$scriptroot/build.sh $commonArgs -subset libs $librariesArgs /p:ILAsmToolPath=$ilasmPath $additionalArgs
+find $scriptroot/artifacts/ -type f -name Build.binlog -exec rename "Build.binlog" "librariesBuild.binlog" * {} \;
+echo "Running command: $scriptroot/build.sh $commonArgs -subset corehost+installer.managed+installer.depprojs+installer.pkgprojs+bundles $installerArgs /p:ILAsmToolPath=$ilasmPath $additionalArgs"
+$scriptroot/build.sh $commonArgs -subset corehost+installer.managed+installer.depprojs+installer.pkgprojs+installers+bundles $installerArgs /p:ILAsmToolPath=$ilasmPath $additionalArgs
+find $scriptroot/artifacts/ -type f -name Build.binlog -exec rename "Build.binlog" "installerBuild.binlog" * {} \;

Moving NuGet forward to netstandard2.1 or even net5.0 might be a way forward. But we haven't yet documented why we need to do this in certain cases: #1763. @dseefeld @crummel is this reasonable?

In #1834 I'm trying the use net5.0 target approach. It would be interesting to flow the target framework into the projects getting built, something like DotNetBuildFromSourceTargetFramework.

@dagood
Copy link
Member

dagood commented Oct 25, 2020

these packages get built from runtime repo, right?

Yes, this would be the src/libraries section I believe, $scriptroot/build.sh $commonArgs -subset libs $librariesArgs. This is what @dseefeld investigated--whether a fix can be made on that side.

On the other side, I confirmed with @crummel in our standup that changing NuGet.Client to target net5.0 does seem like the right approach. (We still need to document why this is what we do, IMO, but we expect this to be the most viable way forward right now.)

Having the projects automatically target the latest target framework feels wrong to me as a long-term solution (more about that at #1763). But flowing that in as a property is definitely something to consider as a way to get rid of patches if we end up needing to always target the latest framework for some reason.

@tmds
Copy link
Member Author

tmds commented Oct 26, 2020

Yes, this would be the src/libraries section I believe, $scriptroot/build.sh $commonArgs -subset libs $librariesArgs. This is what @dseefeld investigated--whether a fix can be made on that side.

When I build the libs subset, it doesn't build any nupkg files for me. I haven't found any docs about it in runtime repo, besides how to manually pack it: https://github.com/dotnet/runtime/blob/master/docs/workflow/building/libraries/README.md#build-packages.

@dagood
Copy link
Member

dagood commented Oct 26, 2020

Well, System.Security.Cryptography.Cng.5.0.0-rc.1.20451.14.nupkg is created here in the PR build libraries binlog:

image

Maybe you could explain why you're trying to run this manually (presumably outside the context of source-build)?

@tmds
Copy link
Member Author

tmds commented Oct 26, 2020

Well, System.Security.Cryptography.Cng.5.0.0-rc.1.20451.14.nupkg is created here in the PR build libraries binlog:

Thanks! Can I open these logs on Linux?

Maybe you could explain why you're trying to run this manually (presumably outside the context of source-build)?

I can try things much faster by patching the repos directly. Maybe there are better ways to patch things in source-build, but I don't know those workflows.

@tmds
Copy link
Member Author

tmds commented Oct 26, 2020

They get built conditionally on DotNetBuildFromSource being set to true.

@dagood
Copy link
Member

dagood commented Oct 26, 2020

Thanks! Can I open these logs on Linux?

I've been able to build and run the binlog viewer on macOS with the Avalonia flavor: https://github.com/KirillOsenkov/MSBuildStructuredLog. There's also an online one but I have no idea if that'll work with the size of these logs. (From what I've seen the online one has a reduced feature set too.)

I don't know if there's a better way to have a fast dev loop. In the past I've copied the environment lines from the default logs into a script that then re-runs the entry command. In theory the build is incremental enough that you could delete some patch + build semaphores to rerun what you want, but I haven't tried that.

But why are you running dotnet/runtime? @dseefeld has noted there are problems when he tried that approach.

@dseefeld
Copy link
Contributor

The runtime libraries build only builds net5.0 packages right now. Discussions with the runtime team suggested that we could build using --allconfigurations in the runtime build to get other TFMs built. I attempted this, but came across an issue that will not be able to be fixed for 5.0. So, I think the approach of building NuGet client for netstandard2.1 or net5.0 makes sense.

@tmds
Copy link
Member Author

tmds commented Oct 27, 2020

So, I think the approach of building NuGet client for netstandard2.1 or net5.0 makes sense.

I've updated the PR to build for net5.0.

CI has a hickup:

2020-10-27T09:41:55.5816737Z + /src/eng/common/dotnet-install.sh -runtime dotnet -version 3.1.1
2020-10-27T09:41:55.6017354Z Downloading 'https://dot.net/v1/dotnet-install.sh'
2020-10-27T09:41:56.1715723Z curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.
2020-10-27T09:41:56.1763973Z bash: /src/.dotnet/dotnet-install.sh: No such file or directory
2020-10-27T09:41:56.1873338Z Failed to install dotnet SDK (exit code '127').

@dagood
Copy link
Member

dagood commented Oct 27, 2020

One job hit that (opened #1839 to track as potential flakiness), but the others hit targetframework issues:

  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Common/Microsoft.TestPlatform.Common.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Client/Microsoft.TestPlatform.Client.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft.TestPlatform.Extensions.TrxLogger.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/testhost/testhost.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/testhost/testhost.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1) / win7-x64. Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/vstest.console/vstest.console.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/vstest.console/vstest.console.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1) / win7-x64. Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/package/package/package.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Microsoft.TestPlatform.VsTestConsole.TranslationLayer.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.Utilities/Microsoft.TestPlatform.Utilities.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.TestHostProvider/Microsoft.TestPlatform.TestHostProvider.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/testhost.x86/testhost.x86.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]
  /src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/src/testhost.x86/testhost.x86.csproj : error NU1202: Package NuGet.Frameworks 5.8.0-preview.3.6783 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1) / win7-x86. Package NuGet.Frameworks 5.8.0-preview.3.6783 supports: net5.0 (.NETCoreApp,Version=v5.0) [/src/artifacts/src/vstest.0c0fafa64de5c73981e7c40a99d7363f57635f60/TestPlatform_BuildFromSource.sln]

This is the virality I mentioned in #1763, the downstreams need to compensate now and also build for net5.0 rather than netcoreapp2.1/netstandard2.0.

@tmds
Copy link
Member Author

tmds commented Oct 29, 2020

Well look at that, CI passed! 😮

@dagood @dseefeld this is up for review.

Copy link
Member

@dagood dagood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using NetStandardVersion this way is obviously not intended in the repo, but the end result makes sense as far as source-build goes.

<VSThreadingVersion>16.6.13</VSThreadingVersion>
<!-- TODO - remove this when temporary patching is no longer necessary. See https://github.com/nuget/home/issues/8952 -->
- <PatchedSystemPackagesVersion>5.0.0-preview.3.20214.6</PatchedSystemPackagesVersion>
+ <PatchedSystemPackagesVersion>5.0.0-rc.1.20451.14</PatchedSystemPackagesVersion>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dagood this version probably needs an update by now. Is there a way to write this so it doesn't require patching?

Copy link
Member

@dagood dagood Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking to avoid the patch, this could be passed in as /p:PatchedSystemPackagesVersion=5.0.0 in the source-build proj, since global properties (that syntax) can't be overridden by this props file.

To avoid hard-coding a version, it could use a property imported from the generated PackageVersions.props file. It might be as simple as changing usages of PatchedSystemPackagesVersion to instead use the "actual" version props, like SystemSecurityCryptographyProtectedDataVersion, to pick up what dotnet/runtime built. This has plenty of nuance with how the projects actually evaluate in this specific case though. Not familiar enough with the repo to know more off the top of my head.

@tmds tmds changed the title nuget.client: System.Security.Cryptography packages: match system package version nuget.client: build for .NET 5 Nov 5, 2020
@dagood
Copy link
Member

dagood commented Nov 5, 2020

The last CI run is before GA was merged, so I'd kind of expect merging this to cause the rolling build to fail. Not sure how to get GitHub to redo the CI merge other than pushing a commit to this PR.

@tmds
Copy link
Member Author

tmds commented Nov 12, 2020

I've rebased on master. Let's see what CI makes of it.

<NETFXTargetFrameworkVersion>v4.7.2</NETFXTargetFrameworkVersion>
<NETFXTargetFramework>net472</NETFXTargetFramework>
- <NETCoreTargetFramework>netcoreapp2.1</NETCoreTargetFramework>
+ <NETCoreTargetFramework>netcoreapp5.0</NETCoreTargetFramework>
Copy link
Member

@omajid omajid Nov 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be net5.0? I thought netcoreapp5.0 is just an obsolete alias for that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upstream repo hasn't adopted net5.0 yet, and some of the build logic relies on it being netcoreapp5.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying that!

@tmds
Copy link
Member Author

tmds commented Nov 12, 2020

@dagood what does it mean when _Production builds succeed, and _Online/_Offline don't?

Looking at the logs for the failing builds makes me wonder if this patch was applied, for example:

error NU1603: NuGet.Packaging 5.8.0-rc.6930 depends on System.Security.Cryptography.Pkcs (>= 5.0.0-preview.3.20214.6) but System.Security.Cryptography.Pkcs 5.0.0-preview.3.20214.6 was not found. An approximate best match of System.Security.Cryptography.Pkcs 5.0.0 was resolved.

@dagood
Copy link
Member

dagood commented Nov 12, 2020

what does it mean when _Production builds succeed, and _Online/_Offline don't?

This means it's able to build using prebuilt dependencies and create the tarball (Production), but building the tarball (Online/Offline) didn't work. (Offline = internet feeds removed, Online = still there.) This is a pretty common state to be in. 😛

I'll take a look, I wonder if the mismatched 5.0.0 vs. prerelease is related to this being changed to true in the 5.0 GA PR:

<UseStableVersions Condition="'$(UseStableVersions)' == ''">true</UseStableVersions>

dotnet/arcade should probably accept 5.0.0, but I'll have to look at what's going on.

@dagood
Copy link
Member

dagood commented Nov 12, 2020

Looking at the logs for the failing builds makes me wonder if this patch was applied, for example:

Ah right--this is kind of happening. The version of the NuGet packages being put into the build are the ones from the previously-source-built tarball, which were built in an earlier rolling build, so they don't have this patch. Online/Offline download a cached previously-source-built as an approximation of the N-1 => N flow.

(A bootstrap build would have this patch, IIRC, because nupkgs built in stage 1 (Production) get fed into the tarball as previously-source-built.)

I think the bit that's causing a problem here is that the prebuilt System.Security packages that we actually put in the tarball are based on the current Production build (with this patch), so we don't include them. However, previously-source-built packages still have their old dependencies from when they were originally built (without this patch), so now they can't find them.

A few ideas:

  • We could patch dotnet/arcade to force upgrade System.Security.Cryptography.Pkcs to 5.0.0 rather than relying on NuGet.Packaging's dependency. (Add eng/Versions.props prop for source-build to override, add PackageReference using that.)
    • Could remove the patch after we flow a new previously-source-built tar.gz when it's convenient.
    • I don't know if this will have to be done across multiple repos (dotnet/arcade just being the first)--maybe.
  • We could hack up a previously-source-built tar.gz that contains NuGet packages with the patch.
  • Could find some new mechanism to get the prebuilts required by previously-source-built, not just the Production build.
  • Could stop using the cached N-1 => N flow. (Until we get into 5.0 servicing?)

The first seems the most doable + maintainable short term. It seems like reproing locally will be pretty important to reasonably work on that (since the build takes so long), I'd expect ./build-source-tarball.sh ../Somewhere; cd ../Somewhere; ./build.sh should repro. After the first build and just working on patches I think ./build-source-tarball.sh ../Somewhere --skip-build; cd ../Somewhere; ./build.sh will work. (Can also try to do more incremental builds with just the tarball, but there's probably a decent risk of cache pollution.)

On the other hand, I do wonder if we could just toss these System.Security packages into SBRP. That usually seems to be more predictable and direct, even though moving to net5.0 does seem correct to me. 😕

@dagood
Copy link
Member

dagood commented Nov 12, 2020

  • Could stop using the cached N-1 => N flow. (Until we get into 5.0 servicing?)

I brought this up with the team and we think it makes sense for 5.0.0. Instead of downloading a previously-source-built.tar.gz, we'll pack up the nupkgs produced by the production build. I'm hopeful it's a tweak to the tarball generation code rather than something drastic. (We'll still produce previously-source-built.tar.gz files so that we can go back to a sort-of N-1 => N flow for 5.0.1.)

Once I get that done, I expect this PR should work.

(And this should let us remove those cyclic roslyn-analyzer prebuilts too. (#1878) 😄)

@tmds
Copy link
Member Author

tmds commented Nov 13, 2020

@dagood thanks for the thorough explanation!

Online/Offline download a cached previously-source-built as an approximation of the N-1 => N flow.

What artifacts does Online/Offline use from the previous source-build, and which come from the PR Production build?

<VSThreadingVersion>16.7.56</VSThreadingVersion>
<!-- TODO - remove this when temporary patching is no longer necessary. See https://github.com/nuget/home/issues/8952 -->
- <PatchedSystemPackagesVersion>5.0.0-preview.3.20214.6</PatchedSystemPackagesVersion>
+ <PatchedSystemPackagesVersion>5.0.0</PatchedSystemPackagesVersion>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dseefeld this change is for getting rid of the System.Security.Cryptography.Cng,5.0.0-preview.3.20214.6 and System.Security.Cryptography.Pkcs,5.0.0-preview.3.20214.6 prebuilts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Thanks. I updated the prebuilt wiki to include the PR and assigned you.

@dagood
Copy link
Member

dagood commented Nov 13, 2020

What artifacts does Online/Offline use from the previous source-build, and which come from the PR Production build?

packages/archive/Private.SourceBuilt.Artifacts.0.1.0-dev.tar.gz in a tarball is the prev-sb tar.gz (the SBRP tarball is also in that dir), everything else is from Production. Prev-sb contains a coreclr-tools dir with the portable build's ilasm, ildasm, libcoreclr.so, and System.Private.CoreLib.dll, and in the prev-sb root dir, all nupkg outputs from these builds are combined (and the portable build outputs "win" if there's overlap):

gatherJobs:
- job: centos71_Offline
- job: centos8_Offline
- job: debian9_Online
- job: fedora31_Offline
gatherPortableJob: centos71_Offline_Portable

@dagood
Copy link
Member

dagood commented Nov 16, 2020

Once I get that done, I expect this PR should work.

Merged #1881! Should be ready to try a merge/rebase of this PR and see if that helps.

@dagood
Copy link
Member

dagood commented Nov 17, 2020

CI caught this issue with building nuget for net5.0 but arcade targeting netcoreapp2.1:

Errors
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj error NU1202: Package NuGet.Packaging 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Packaging 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj error NU1202: Package NuGet.ProjectModel 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.ProjectModel 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.SourceBuild/tasks/Microsoft.DotNet.SourceBuild.Tasks.csproj error NU1202: Package NuGet.Versioning 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Versioning 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk.csproj error NU1202: Package NuGet.Packaging 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Packaging 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk.csproj error NU1202: Package NuGet.Packaging 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Packaging 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk.csproj error NU1202: Package NuGet.ProjectModel 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.ProjectModel 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk.csproj error NU1202: Package NuGet.Versioning 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Versioning 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.Packaging/src/Microsoft.DotNet.Build.Tasks.Packaging.csproj error NU1202: Package NuGet.Commands 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Commands 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.Packaging/src/Microsoft.DotNet.Build.Tasks.Packaging.csproj error NU1202: Package NuGet.Packaging 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Packaging 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Build.Tasks.Packaging/src/Microsoft.DotNet.Build.Tasks.Packaging.csproj error NU1202: Package NuGet.ProjectModel 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.ProjectModel 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]
    /tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj error NU1202: Package NuGet.Versioning 5.8.0-rc.6930 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package NuGet.Versioning 5.8.0-rc.6930 supports: net5.0 (.NETCoreApp,Version=v5.0) [/tb/tarball_887998/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/Arcade.sln]

(Copied from binlog to make it easier to read (IMO).)

@dagood
Copy link
Member

dagood commented Nov 17, 2020

I guess this is being subsumed by #1890 which will address that.

@tmds
Copy link
Member Author

tmds commented Nov 23, 2020

This was included in #1890.

@tmds tmds closed this Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants