Aspnetcore: invalid Microsoft.NETCore.App after upgrade to SDK 2.1.401

Created on 29 Aug 2018  Â·  25Comments  Â·  Source: dotnet/aspnetcore

After upgrading MS to 15.8.2 with SDK 2.1.401 today my web app (netcoreapp21) failed to build with

Severity Code Description Project File Line Suppression State
Error NETSDK1061: The project was restored using Microsoft.NETCore.App version 2.1.2, but with current settings, version 2.1.3-servicing-26724-03 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection. …

adding a global.json pinning the SDK to 2.1.400 allows the project to compile.

It appears something in the new SDK is referencing Microsoft.NETCore.App version 2.1.3-servicing-26724-03 from a MyGet feed

External

Most helpful comment

It appears Visual Studio bundled the wrong build of the CLI. @livarcocc's team is working with the VS team to investigate fixes. I'm going to close this as a duplicate of https://github.com/dotnet/cli/issues/9897.

The recommended workaround is to uninstall 2.1.401, download the correct 2.1.401 installers from https://www.microsoft.com/net/download/dotnet-core/2.1, and install those instead.

All 25 comments

@natemcmaster @JunTaoLuo

@matthewDDennis - what feeds do you have in your NuGet.config?

I can build and run locally. Cannot publish I get the publish error (I can run locally) whether self-contained or framework-dependent in the publish settings. Web deploy to an on-premises server.

No additional nuget feeds.

image

Hmm where was this .NET Core SDK installed from? An official release, or a nightly build?

On dev machine, VS update. On target machine official release (hosting bundle)

I just have the standard NuGet feed and a local directory for NuGet sources. I don't play with the nightlies for production work.

The SDK was installed with VS update to 15.8.2.

@tbasallo can you run dotnet --info on command line and share the output? Also, can you share a binary log from publish? dotnet publish -bl This produces a file named "msbuild.binlog"

FYI @livarcocc @dsplaisted - potentially urgent issue in VS 15.8.2 with self-contained rollforward.

### --info

C:\Projects\Tedd>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032

Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.401\

Host (useful for support):
Version: 2.1.3-servicing-26724-03
Commit: 124038c13e

.NET Core SDKs installed:
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
1.1.0 [C:\Program Files\dotnet\sdk]
2.0.0 [C:\Program Files\dotnet\sdk]
2.0.2 [C:\Program Files\dotnet\sdk]
2.0.3 [C:\Program Files\dotnet\sdk]
2.1.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.102 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

C:\Projects\Tedd>

I'll send an internal email about this. If VS installed a servicing build, something probably went wrong in the CLI to VS handoff.

As a workaround, try going to Windows Settings > Apps and uninstalling "Microsoft .NET Core SDk 2.1.401".

One more thing: before you uninstall, can you share the file version of the installer? This is visible in Windows Settings. For example:

image

Control panel says 2.1.401

image

Can't seem to find in Win7 anything else

Just checked a Win10 machine that was also updated this AM and it shows 2.1.401. It's not on the same network so I cannot build/publish that same project to test.

I too have the Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Thanks for all the details, we are working with @livarcocc to get to the bottom of this.

It appears Visual Studio bundled the wrong build of the CLI. @livarcocc's team is working with the VS team to investigate fixes. I'm going to close this as a duplicate of https://github.com/dotnet/cli/issues/9897.

The recommended workaround is to uninstall 2.1.401, download the correct 2.1.401 installers from https://www.microsoft.com/net/download/dotnet-core/2.1, and install those instead.

This appears to have fixed it, but I had to do a dotnet restore -f at the root directory of the solution before it would compile without errors using SDK 2.1.401

The proposed solution from @natemcmaster tied with the dotnet restore comment from @matthewDDennis fixed the issue. Thank you.

When trying to publish a Web Job to Azure, this error is now a result:

Severity    Code    Description Project File    Line    Suppression State
Error   NETSDK1005  Assets file '-----\obj\project.assets.json' doesn't have a target for '.NETStandard,Version=v2.0'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project.        C:\Program Files\dotnet\sdk\2.1.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets    198 

However, a normal Web App publish does not have this error.

Any hints? It is very tiresome with these errors ... and i suspect they are related to the latest VS2017 update that introduced the other error mentioned in this thread.

@gimlichael can you open a separate issue for this? It appears unrelated to the original issue.

I ran into the same issue when I tried to publish then kept seeing it after that. Uninstalling SDK 2.1.401 fixed it for me. I still have 2.1.400 installed.

you need to set the TargetLatestRuntimePatch to false in the project file,and Specified sdk version

Update my Core SDK, it's ok to work.

I don't know what caused the issue, but it might be related to @Mcgrady2009 suggestion. I deleted the publish profile and closed Visual Studio. After opening and creating a new publish profile, it worked again.

I just hope that with our feedback, that the team can and will improve the error messages. At least for me, it did not make any sense .. and only added to frustration.

Otherwise; keep up the good work - and happy coding :-)

Microsoft has released an update for this problem. Installing Visual Studio 2017, 15.8.3 will fix this.

Was this page helpful?
0 / 5 - 0 ratings