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

CentOS 8 Update to 3.1.8 Causes netstandard2.1 Target Build Failure (with Workaround) #5212

Closed
TikiBill opened this issue Sep 15, 2020 · 5 comments

Comments

@TikiBill
Copy link

TikiBill commented Sep 15, 2020

Issue

Upgrading from dotnet-sdk-3.1.7 to 3.1.8 causes any netstandard2.1 targeted builds to fail.

  1. Upgrade (dnf update dotnet*)
  2. dotnet new classlib
  3. change target to netstandard2.1
  4. build
/usr/share/dotnet/sdk/3.1.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(283,5): error MSB4018: The "ResolveTargetingPackAssets" task failed unexpectedly. [/home/bill/Code/scratch/test1/test1.csproj]
/usr/share/dotnet/sdk/3.1.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(283,5): error MSB4018: System.IO.FileNotFoundException: Could not find file '/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/data/FrameworkList.xml'. [/home/bill/Code/scratch/test1/test1.csproj]

Fix

rm -rfv /usr/share/dotnet/packs/NETStandard.Library.Ref
rm -rfv /usr/share/dotnet/packs/Microsoft.NETCore.App.Ref

Now the build works.

A similar workaround is mentioned in #4526 (comment) so perhaps this issue is a dup?

Thanks!

(Also, thank you so much for all the work and great ecosystem!)

EDIT: Add second directory which needs to be deleted.

@dagood
Copy link
Member

dagood commented Sep 15, 2020

@TikiBill, could you try running dnf list installed 'dotnet-*' 'netstandard-*' 'aspnetcore-*'? For example, this is what I get with the packages installed that were built by CentOS:

aspnetcore-runtime-3.1.x86_64                     3.1.7-1.el8_2                @AppStream
aspnetcore-targeting-pack-3.1.x86_64              3.1.7-1.el8_2                @AppStream
dotnet-apphost-pack-3.1.x86_64                    3.1.7-1.el8_2                @AppStream
dotnet-host.x86_64                                3.1.7-1.el8_2                @AppStream
dotnet-hostfxr-3.1.x86_64                         3.1.7-1.el8_2                @AppStream
dotnet-runtime-3.1.x86_64                         3.1.7-1.el8_2                @AppStream
dotnet-sdk-3.1.x86_64                             3.1.107-1.el8_2              @AppStream
dotnet-targeting-pack-3.1.x86_64                  3.1.7-1.el8_2                @AppStream
dotnet-templates-3.1.x86_64                       3.1.107-1.el8_2              @AppStream
netstandard-targeting-pack-2.1.x86_64             3.1.107-1.el8_2              @AppStream

I think you probably have mixed Microsoft-built and CentOS-built packages installed. This can be a problem around new updates with both repos enabled at the same time.

Some more details at: dotnet/sdk#12075 (comment), and someone else mentioned this fix in the next comment:

Disabling the repository using:

sudo dnf config-manager --set-disabled packages-microsoft-com-prod

Then uninstalling the binaries and reinstalling with the F32 provided packages did the trick. Thank you very much.

@TikiBill
Copy link
Author

Thank you for the quick response.

Indeed the conflicting repositories caused the issue. I had a yet-to-be-updated VM and made the suggested configuration change (disabling the MS repo) and all went well. I've updated my ansible script (originally for CentOS 7) to not include the MS .NET repo.

Closing as user error.

Thanks again.

@HymanZHAN
Copy link

@dagood Sorry to comment on a closed issue, but I am curious if there'are conflicts between Fedora/CentOS-built ones and Microsoft-built ones, how can I use the one built by Microsoft? I am asking because the Fedora one is still on 3.1.108 which does not come with WASM templates OOB and I want to use the latest 3.1.403. Thanks!

@omajid
Copy link
Member

omajid commented Oct 22, 2020

If there'are conflicts between Fedora/CentOS-built ones and Microsoft-built ones, how can I use the one built by Microsoft?

One way to do that is to exclude (aka disable) these packages from the Fedora repo. Then you can install them using the Microsoft repo or through a manual tarball.

Adding this line under [fedora] and [updates] in /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo should do the trick:

exclude=dotnet* aspnet* netstandard*

Here's what the files look like on my end after making this change:

/etc/yum.repos.d/fedora.repo:

[fedora]
name=Fedora $releasever - $basearch
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
countme=1
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
exclude=dotnet* aspnet* netstandard*

[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[fedora-source]
name=Fedora $releasever - Source
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

/etc/yum.repos.d/fedora-updates.repo:

[updates]
name=Fedora $releasever - $basearch - Updates
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
exclude=dotnet* aspnet* netstandard*

[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[updates-source]
name=Fedora $releasever - Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

The same change should work for CentOS 8 as well.

@HymanZHAN
Copy link

HymanZHAN commented Oct 22, 2020

@omajid Thanks! I will give it a try.

Update: It's working great. Thanks a bunch!

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

No branches or pull requests

4 participants