Skip to content

Update .NET Core SDK #14643

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

Merged
merged 1 commit into from
Mar 5, 2019
Merged

Update .NET Core SDK #14643

merged 1 commit into from
Mar 5, 2019

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented Feb 7, 2019

Blocked on dotnet/sdk#2867

@bricelam
Copy link
Contributor Author

bricelam commented Feb 7, 2019

Desperately waiting for dotnet/arcade#811

@bricelam bricelam removed the blocked label Feb 12, 2019
@bricelam
Copy link
Contributor Author

bricelam commented Feb 12, 2019

error NU1605: Detected package downgrade: Microsoft.NETCore.Platforms from 3.0.0-preview.19112.1 to 3.0.0-preview.19107.12. Reference the package directly from the project to select a different version.
error NU1605:  Microsoft.EntityFrameworkCore.InMemory.Tests -> Microsoft.NETCore.App 3.0.0-preview-27412-2 -> Microsoft.NETCore.Platforms (>= 3.0.0-preview.19112.1)
error NU1605:  Microsoft.EntityFrameworkCore.InMemory.Tests -> Microsoft.NETCore.Platforms (>= 3.0.0-preview.19107.12)

☹️ I thought I fixed this with these MSBuild properties. Any insights, @natemcmaster? Diamond dependency involving dotnet/corefx and dotnet/core-setup?

global.json Outdated
@@ -1,9 +1,9 @@
{
"tools": {
"dotnet": "3.0.100-preview-010010"
"dotnet": "3.0.100-preview4-010309"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend not proceeding beyond preview 3 yet. Our master branch is still at preview 3. Preview 3 SDKs can be found in the 'release/3.0.1xx' column on this page: https://github.com/dotnet/core-sdk/tree/release/3.0.1xx#installers-and-binaries

@natemcmaster
Copy link
Contributor

@bricelam I don't think it's a diamond dependency issue. The error says you have a forced downgrade from Microsoft.NETCore.App 3.0.0-preview-27412-2. This version doesn't match what is in eng/Versions.props: https://github.com/bricelam/EFCore/blob/7cb0a3f5c4711b88708845b73847047d18e9822b/eng/Versions.props#L50

 <MicrosoftNETCoreAppPackageVersion>3.0.0-preview-27407-4</MicrosoftNETCoreAppPackageVersion>

So, my guess is the real problem is that MicrosoftNETCoreAppPackageVersion isn't actually being used to control the implicit package version.

@natemcmaster
Copy link
Contributor

@dsplaisted
Copy link
Member

@natemcmaster It looks like the changes you reference might break this, but I don't think they have flowed into a build of the .NET Core SDK yet, so I don't think they would be breaking anything yet.

@bricelam
Copy link
Contributor Author

Ugg. They're back.

error NU1605: Detected package downgrade: Microsoft.NETCore.Platforms from 3.0.0-preview.19109.6 to 3.0.0-preview.19107.12. Reference the package directly from the project to select a different version.
error NU1605:  StreamingSample -> Microsoft.NETCore.App 3.0.0-preview3-27413-7 -> Microsoft.NETCore.Platforms (>= 3.0.0-preview.19109.6)
error NU1605:  StreamingSample -> Microsoft.NETCore.Platforms (>= 3.0.0-preview.19107.12)

@smitpatel
Copy link
Contributor

package downgrade loves @bricelam :trollface:

@dsplaisted
Copy link
Member

It looks like you're directly referencing the Microsoft.NETCore.Platforms package (though it might be implicit). Is that the case? What do you need to reference that package for?

@natemcmaster
Copy link
Contributor

@dsplaisted
Copy link
Member

@natemcmaster If you do that then you'll need to keep updating that version to make sure it's at least equal to the version referenced by Microsoft.NETCore.App. When we switch to the .Ref package, this should no longer be necessary.

I imagine that this is needed because you're overriding the version of .NET Core that the SDK would give you by default.

@natemcmaster
Copy link
Contributor

@dsplaisted yes, that's correct.

@bricelam since I last reviewed this PR, it looks like the versions of NETCore.App and the SDK have changed. I think originally the problem was that RuntimeFrameworkVersion was not honored by the SDK, but now it appears this is the diamond dependency problem. I believe you need to consume a newer version of CoreFX packages to match the updated version of Microsoft.NETCore.App. It's possible this didn't surface until now because the version of the SDK you were using didn't use the BundledNETCorePlatformsPackageVersion property.

In EF Core:

https://github.com/aspnet/EntityFrameworkCore/blob/640bc8d568b8475604d121ba78aa29c594cf3611/eng/Version.Details.xml#L44-L47

https://github.com/aspnet/EntityFrameworkCore/blob/640bc8d568b8475604d121ba78aa29c594cf3611/eng/Version.Details.xml#L70-L73

In core-setup:

https://github.com/dotnet/core-setup/blob/1c23cf9539146805f8c8072c6f9f4d194f13f6bf/eng/Version.Details.xml#L8-L11

    <Dependency Name="Microsoft.NETCore.Platforms" Version="3.0.0-preview.19109.6">
      <Uri>https://github.com/dotnet/corefx</Uri>
      <Sha>0abec4390b30fdda97dc496594f9b1f9c9b20e17</Sha>
    </Dependency>

@bricelam bricelam requested a review from dougbu as a code owner March 4, 2019 19:00
@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

@ajcvickers Latest errors:

error NU1605: Detected package downgrade: Microsoft.Win32.Primitives from 4.3.0 to 4.0.1.
error NU1605:  NETStandard.Library 1.6.0 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> Microsoft.Win32.Primitives (>= 4.3.0)
error NU1605:  NETStandard.Library 1.6.0 -> Microsoft.Win32.Primitives (>= 4.0.1)

error NU1605: Detected package downgrade: System.Net.Primitives from 4.3.0 to 4.0.11.
error NU1605:  NETStandard.Library 1.6.0 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Net.Primitives (>= 4.3.0)
error NU1605:  NETStandard.Library 1.6.0 -> System.Net.Primitives (>= 4.0.11)

@dougbu
Copy link
Contributor

dougbu commented Mar 4, 2019

Latest errors…

I suspect there's a race between when the CI jobs restore packages and when NuGet / MyGet / whatever finish indexing. Have you tried Retry on the pipelines page?

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

@dougbu This happens locally too. No idea what's actually conflicting with what. The errors makes it sound like NETStandard.Library version 1.6.0 is internally inconsistent, but that's unlikely.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Something may be upgrading the runtime.win.* packages to an incompatible version. Maybe Microsoft.NETCore.App...

@dsplaisted
Copy link
Member

Can you switch to NETStandard.Library 1.6.1? I think that should resolve the downgrades.

I think what is happening here is that the Microsoft.NETCore.App 1.1.x package adds RID-specific dependencies which end up looking like they come from NETStandard.Library and thus it looks inconsistent. This was a problem in .NET Core 1.x, and the best solution we came up with was to always use version 1.6.1 of the NETStandard.Library package and not to use 1.6.0.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

That worked. New (unrelated) errors:

error NU1603: dotnet-ef depends on runtime.win-x64.Microsoft.WindowsDesktop.App (>= 3.0.0-preview4-27504-2) but runtime.win-x64.Microsoft.WindowsDesktop.App 3.0.0-preview4-27504-2 was not found. An approximate best match of runtime.win-x64.Microsoft.WindowsDesktop.App 3.0.0-preview4-27504-20 was resolved.
error NU1603: dotnet-ef depends on runtime.win-x86.Microsoft.WindowsDesktop.App (>= 3.0.0-preview4-27504-2) but runtime.win-x86.Microsoft.WindowsDesktop.App 3.0.0-preview4-27504-2 was not found. An approximate best match of runtime.win-x86.Microsoft.WindowsDesktop.App 3.0.0-preview4-27504-20 was resolved.
error NU1102: Unable to find package Microsoft.AspNetCore.App.Runtime.win-x64 with version (>= 3.0.0-preview4-27504-2)
error NU1102: Unable to find package Microsoft.AspNetCore.App.Runtime.win-x86 with version (>= 3.0.0-preview4-27504-2)

@wli3 This is happening in the dotnet-ef project. Why is it even trying to restore these?

@dsplaisted
Copy link
Member

@bricelam When targeting .NET Core 3.0, currently it will restore all of the targeting packs (which includes WindowsDesktop) if they aren't part of the SDK. This is because (eventually) there could be a transitive FrameworkReference to that shared framework which is discovered after restore.

Probably the problem here is that you are overriding RestoreAdditionalProjectSources instead of appending to it. If you don't override it, then it should contain the feeds you need to restore that package. See https://github.com/dotnet/core-sdk/blob/master/src/redist/targets/GenerateBundledVersions.targets#L169

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Hmmm, we're just using Arcade's RestoreSources property. I can't see any interaction between Arcade and RestoreAdditionalProjectSources...

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Also, https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json is being used as a source.

@dsplaisted
Copy link
Member

Sorry, there is a whole list of default sources, and I just linked the first line. The link should have been https://github.com/dotnet/core-sdk/blob/master/src/redist/targets/GenerateBundledVersions.targets#L169-L174

For this package, you probably need https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Might actually be a publishing issue. I don't see version 3.0.0-preview4-27504-2 on the feed.

@dsplaisted
Copy link
Member

You are right, that is not the correct version of the package that it should be using.

Are you setting the RuntimeFrameworkVersion? That is a hammer that now applies to all shared frameworks, which doesn't really work when we're in previews and each of the shared frameworks have a different version.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Yes. We set it to dogfood the latest Microsoft.NETCore.App. Is there an alternative? Should we even be trying to dogfood it outside of the SDK?

@dsplaisted
Copy link
Member

I don't know whether you should be dogfooding it outside of the SDK. It certainly has the potential to make things more complicated.

However, if you do want to just use the specified version of Microsoft.NETCore.App, then you should be able to do the following:

<ItemGroup>
    <FrameworkReference Update="Microsoft.NETCore.App" RuntimeFrameworkVersion="$(MicrosoftNETCoreAppPackageVersion)" />
</ItemGroup>

IE, it is possible to specify the RuntimeFrameworkVersion per FrameworkReference, and that code adds that metadata to the implicit FrameworkReference for Microsoft.NETCore.App.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 4, 2019

Things are currently way to complex to manage. Going to try and reduce our direct dependencies to just the ones that are actually needed.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 5, 2019

New error

error MSB4018: The "GenerateShims" task failed unexpectedly.
error MSB4018: System.InvalidOperationException: Sequence contains no matching element
error MSB4018:    at System.Linq.ThrowHelper.ThrowNoMatchException()
error MSB4018:    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateShims.GetApphostAsset(ITaskItem[] apphostsForShimRuntimeIdentifiers, String runtimeIdentifier) in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateShims.cs:line 121
error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateShims.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateShims.cs:line 75
error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 35
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

wack-a-mole

@dsplaisted
Copy link
Member

dsplaisted commented Mar 5, 2019

The GenerateShims failure is actually a bug I fixed yesterday with dotnet/sdk#3002

Unfortunately it looks like it hasn't flowed into a build of the .NET Core SDK. I'll follow up on that.

EDIT: The PR to flow the dependency into dotnet/cli is failing: dotnet/cli#10896

@dougbu
Copy link
Contributor

dougbu commented Mar 5, 2019

Of course, the macOS failure may indicate an issue ☹️

@bricelam
Copy link
Contributor Author

bricelam commented Mar 5, 2019

Thanks for your help yesterday, @dsplaisted. It looks like we're finally unblocked.

@bricelam
Copy link
Contributor Author

bricelam commented Mar 5, 2019

macOS failure looks like some race condition in MSBuild or Arcade. Unrelated to my changes.

Removing some unnecessary dependencies. We'll see if it fails again.

@@ -1,9 +1,9 @@
{
"tools": {
"dotnet": "3.0.100-preview-010010"
"dotnet": "3.0.100-preview4-010612"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@roji Hopefully in the future, updating the SDK will only require changing this file. 😉

@bricelam bricelam removed the blocked label Mar 5, 2019
@bricelam bricelam merged commit c83944d into dotnet:master Mar 5, 2019
@bricelam bricelam deleted the sdk branch March 5, 2019 19:59
@roji
Copy link
Member

roji commented Mar 5, 2019

@bricelam you're my hero...

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.

6 participants