core icon indicating copy to clipboard operation
core copied to clipboard

FrameworkReference 'Microsoft.NETCore.App' was not recognized at (264: 5)

Open rodrigodevelms opened this issue 7 years ago • 64 comments

Hi guys. I am using Debian 10.1, and today I upgraded net core, version 3.0 to 3.0.1 and my application crashed. Error: "FrameworkReference 'Microsoft.NETCore.App' was not recognized at (264: 5)"

dotnet version : 3.0.101

mono version Mono JIT compiler version 6.4.0.198 (tarball Tue Sep 24 01:24:35 UTC 2019) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug Interpreter: yes LLVM: yes(610) Suspend: hybrid GC: sgen (concurrent by default)

rodrigodevelms avatar Nov 20 '19 16:11 rodrigodevelms

How do you acquire .NET Core? The Debian 10 instructions at https://dotnet.microsoft.com/download/linux-package-manager/runtime-current?

Can you post more context around the error, maybe a repro project and steps?

dagood avatar Nov 20 '19 20:11 dagood

I believe @craigjbass hit the same issue and posted more details at https://github.com/dotnet/core/issues/3879#issuecomment-557151044 (many thanks!), copying here because I'm 98% sure it's the same issue and we need to keep track of it:

A few things here @dagood -

  1. I removed dotnet packages entirely to be able to perform a system upgrade.
  2. Went to reinstall dotnet 3.0.0 - so I followed the advice here: https://github.com/dotnet/core/issues/3853#issuecomment-556101411

I think there is something not quite right with the published dependency graph from the dotnet-sdk-3.0 package:

> $ sudo dnf install dotnet-sdk-3.0                                                                                                                                                                                                 ⬡ 10.7.0 
Last metadata expiration check: 0:09:35 ago on Thu 21 Nov 2019 15:38:13 GMT.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                              Architecture                                  Version                                          Repository                                                          Size
==============================================================================================================================================================================================================================================
Installing:
 dotnet-sdk-3.0                                                       x86_64                                        3.0.101-1                                        packages-microsoft-com-prod                                         64 M
Installing dependencies:
 aspnetcore-runtime-3.0                                               x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                        7.5 M
 aspnetcore-targeting-pack-3.0                                        x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                        1.4 M
 dotnet-apphost-pack-3.0                                              x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                         66 k
 dotnet-host                                                          x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                         39 k
 dotnet-hostfxr-3.0                                                   x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                        147 k
 dotnet-runtime-3.0                                                   x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                         29 M
 dotnet-runtime-deps-3.0                                              x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                        2.8 k
 dotnet-targeting-pack-3.0                                            x86_64                                        3.0.1-1                                          packages-microsoft-com-prod                                        3.4 M

Transaction Summary
==============================================================================================================================================================================================================================================
Install  9 Packages

Total download size: 105 M
Installed size: 105 M
Is this ok [y/N]: y

This completed successfully, with the manual install of sudo dnf install -y https://packages.microsoft.com/centos/7/prod/netstandard-targeting-pack-2.1.0-x64.rpm

But I then got this error

15:50	Project 'Frank.EndToEndTests' load finished with warnings: The FrameworkReference 'Microsoft.NETCore.App' was not recognized at (264:5)

Which seemed rather odd.

I then manually installed this package https://packages.microsoft.com/centos/7/prod/dotnet-targeting-pack-3.0.0-x64.rpm

And everything worked!

image

  • I think the dotnet-sdk-3.0 package should have a dependency on dotnet-targeting-pack-3.0.0, unless I'm missing something?
  • It's more than a checksum issue, I think there are some issues with the yum repos

Hmm - just relooking over the dnf transaction output - it does include dotnet-targeting-pack-3.0

image

These are for 3.0.1!

==============================================================================================================================================================================================================================================
 Package                                                               Architecture                                       Version                                              Repository                                                Size
==============================================================================================================================================================================================================================================
Downgrading:
 dotnet-targeting-pack-3.0                                             x86_64                                             3.0.0-1                                              @commandline                                             3.4 M

Transaction Summary
==============================================================================================================================================================================================================================================
Downgrade  1 Package

I think the packages are missing the minor version which is causing major confusion!

Notice that yum is treating this as a downgrade, so I can't target 3.0.1 and 3.0.0 on the same machine. :sadface:

EDIT: dnf repos expect these packages to respect semver. I think we should have dotnet-targeting-pack-3.0.0 and dotnet-targeting-pack-3.0.1 packages published separately so that they can both be installed side-by-side

EDIT EDIT: :thinking: so the alternative here I see is that the 3.0.1-1 is supposed to be backwards compatible, and there's actually a defect in it.

dagood avatar Nov 21 '19 19:11 dagood

The root issue here is that dotnet-targeting-pack-3.0-3.0.1 shouldn't have been published at all. 3.0.0 should be the latest. @leecow, can these be removed?

(In future 3.0 patches, this won't be an issue because we won't even build targeting packs we don't intend to release. We didn't have this protection while building 3.0.1. https://github.com/dotnet/core-setup/pull/8827.)


I think we should have dotnet-targeting-pack-3.0.0 and dotnet-targeting-pack-3.0.1 packages published separately so that they can both be installed side-by-side

You should never need a targeting pack from a lower patch version. We include major.minor in the package name so that you can install multiple .NET Core versions side-by-side, but only the latest patch of each one.

This problem should be self-healing if your machine has access to the internet... the SDK will detect that you don't have 3.0.0 installed, download Microsoft.NETCore.App.Ref 3.0.0 from nuget.org to your user directory, and use that. Targeting packs (".Ref") don't roll forward so the version match needs to be exact.

We intend to support offline scenarios so this is something that I believe needs fixing.

dagood avatar Nov 21 '19 19:11 dagood

@craigjbass taking another look at this, I do think that having dotnet-sdk-3.0-3.0.101 depend on exactly dotnet-targeting-pack-3.0.3.0.0 would be another way to solve this, and would be more robust for other situations too. I opened https://github.com/dotnet/core-sdk/issues/5738 to track and discuss this. (There might be reasons to keep this version "floating" that I forgot or don't know, we'll see there.)

dagood avatar Nov 21 '19 19:11 dagood

I mentioned to @mmitche that we needed to avoid pushing these, but there was a lot of things having to go on for that release.

nguerrera avatar Nov 21 '19 21:11 nguerrera

I would still not publish packages that aren't intended to be used, even if sdk were stricter about avoiding them. Which is what we will do moving forward, right:not publish unless they are actually needing a patch?

nguerrera avatar Nov 21 '19 21:11 nguerrera

I would still not publish packages that aren't intended to be used, even if sdk were stricter about avoiding them. Which is what we will do moving forward, right:not publish unless they are actually needing a patch?

Agreed completely, and yes, we merged https://github.com/dotnet/core-setup/pull/8827 for 3.0.2+ so that we won't even create these packages unless there's a patch.

dagood avatar Nov 21 '19 21:11 dagood

Thank's all for helping. But something very strange happened. I installed netcore by adding the repository to debian repo. I deleted the obj and bin folders and the error continued. Even creating a new project, the error persisted. So I decided to restart the laptop, and everything worked. Very strange.

rodrigodevelms avatar Nov 22 '19 12:11 rodrigodevelms

Same problem here...

Reinstall doesn't help

dotnet --info .NET Core SDK (reflecting any global.json): Version: 3.0.101 Commit: bc5f8df0f5

Runtime Environment: OS Name: linuxmint OS Version: 18.3 OS Platform: Linux RID: linuxmint.18.3-x64 Base Path: /usr/share/dotnet/sdk/3.0.101/

Host (useful for support): Version: 3.0.1 Commit: 19942e7199

.NET Core SDKs installed: 3.0.101 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

mtarlac avatar Nov 22 '19 15:11 mtarlac

Heads up, I think this is still known and expected to be broken at the moment.

It would be helpful if someone could provide a repro project. I'm aware of one scenario that is broken: installing .NET Core SDK, turning off your internet, then trying to build, but that doesn't seem to be what you're hitting in this thread.

dagood avatar Nov 22 '19 16:11 dagood

I have pretty much the same setup as @mtarlac (and the same problem). I "fixed" it by downloading the version 3.0.100 binary from microsoft (https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.0.100-linux-x64-binaries) and using that instead of the version 3.0.101 the package manager provides.

togamid avatar Nov 22 '19 20:11 togamid

3.0.100 is out of date, if you want to use the tar.gz you should use 3.0.101: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.0.101-linux-x64-binaries

(--At least until the next patch, 3.0.102, comes around. That's a benefit of using the linux repo, you can use your ordinary repo commands to update unless there's an issue like the one being tracked here.)

dagood avatar Nov 22 '19 21:11 dagood

Sameish issue here on Fedora I think. When attempting to open a project I get

The "ResolveTargetingPackAssets" task failed unexpectedly. System.IO.FileNotFoundException: Could not find file "/usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/3.0.0/data/FrameworkList.xml"

When attempting to run any project(new or old with deleted obj/bin directories)

/usr/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(263,5): error MSB4018: The "ResolveTargetingPackAssets" task failed unexpectedly. [/home/[...].csproj]

I did also accidentally dotnet run during the installation...not sure if that has anything to do with my old directory sticking around

What fixed it for me:

I "fixed" it by downloading the version 3.0.100 binary from microsoft (https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.0.100-linux-x64-binaries) and using that instead of the version 3.0.101 the package manager provides.

Using the .gz that dagood referenced. I just copied over and replaced everything. Thanks much, I knew something would break when I saw the upgrading packages..dotnet and Linux don't mix well still. Cheers.

Perustaja avatar Nov 23 '19 02:11 Perustaja

@Perustaja - Same issue on Fedora. The specific issue cited is looking for a file provided by dotnet-targeting-pack-3.0-3.0.0-1. After installing that exact version I now end up with a different issue

PS /tmp> New-Item -Type Directory DotnetTest


    Directory: /tmp

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----          11/22/19  6:13 PM                DotnetTest

PS /tmp> cd ./DotnetTest/                   
PS /tmp/DotnetTest> dotnet new console                 
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /tmp/DotnetTest/DotnetTest.csproj...
  Restore completed in 62.78 ms for /tmp/DotnetTest/DotnetTest.csproj.

Restore succeeded.

PS /tmp/DotnetTest> dotnet build                       
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 13.57 ms for /tmp/DotnetTest/DotnetTest.csproj.
/usr/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3030: Could not copy the file "/tmp/DotnetTest/obj/Debug/netcoreapp3.0/DotnetTest" because it was not found. [/tmp/DotnetTest/DotnetTest.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3030: Could not copy the file "/tmp/DotnetTest/obj/Debug/netcoreapp3.0/DotnetTest" because it was not found. [/tmp/DotnetTest/DotnetTest.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.69

judep90 avatar Nov 23 '19 02:11 judep90

In at least one of these cases it looks like the packs/microsoft.netcore.app.ref/3.0.0 directory still exists which is why it isn’t downloading from nuget. But then the files inside it are missing.

nguerrera avatar Nov 23 '19 04:11 nguerrera

Cc @dsplaisted

nguerrera avatar Nov 23 '19 04:11 nguerrera

In at least one of these cases it looks like the packs/microsoft.netcore.app.ref/3.0.0 directory still exists

Oh... I bet it's caused by this bug in our RPM packages: https://github.com/dotnet/core-setup/issues/8235. The targeting pack directory ownership isn't correct, which means uninstalling the 3.0.0 targeting pack (to upgrade to 3.0.1) left the 3.0.0 dir around with no contents. The netcoreapp targeting/apphost packs, netstandard targeting pack, and project template RPMs have this issue.

When we delete the bad dotnet-targeting-pack-3.0-3.0.1 RPMs, this issue will no longer happen when someone performs a new upgrade because dotnet-targeting-pack-3.0-3.0.0 will be the latest version as expected. If we didn't publish the bad dotnet-targeting-pack-3.0-3.0.1, this uninstall issue wouldn't have shown up in this release.

We should fix the ownership issue anyway because leaving this junk around will eventually cause other problems.

@leecow, can you look for and remove any bad targeting packs that are left? I see there's still one on https://packages.microsoft.com/fedora/30/prod/, dotnet-targeting-pack-3.0.1-x64.rpm.


If you're affected by this, you can manually downgrade to the 3.0.0 version to restore the files:

sudo dnf install dotnet-targeting-pack-3.0-3.0.0

Alternatively, you can simply delete the /usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/3.0.0 directory to clean up after the bad uninstall and let the SDK download the targeting pack from nuget.org.

(Once we remove the remaining bad 3.0.1 targeting pack RPMs, a reinstall will also work, but it looks like they still exist on at least one feed.)

dagood avatar Nov 23 '19 06:11 dagood

Alternatively, you can simply delete the /usr/share/packs/Microsoft.NETCore.App.Ref/3.0.0 directory to clean up after the bad uninstall

/usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/3.0.0 for anyone looking for it

judep90 avatar Nov 24 '19 00:11 judep90

Oops, thanks @judep90, corrected.

dagood avatar Nov 24 '19 01:11 dagood

Ubuntu 18.04 Temporary solution:

  1. sudo apt-get remove dotnet-sdk-3.0 (uninstall latest sdk 3.0-3.101-1)
  2. download previous sdk
  3. sudo tar -xvf dotnet-sdk-3.0.100-linux-x64.tar.gz -C /usr/share/dotnet (unpack downloaded archive)
  4. reload project

tosha-ret avatar Nov 28 '19 05:11 tosha-ret