Migrating to netstandard2.1 - Metadata file '..\bin\Debug\netstandard2.1\App.dll' could not be found

robs23 96 Reputation points
2021-11-24T16:28:52.573+00:00

I have a legacy Xamarin Forms project, started almost 4 years ago in XF 2.5. It used to contain Android & iOS projects, but I lately removed iOS as it wasn't really used. Lately I decided to refresh it completely to be able to use latest & greatest features of C# and all the libraries. So I had to migrate it first from BCL to .netstandard 2.0, after a bit of hassle it compiled and it's been working well ever since. As I wanted to use some Android API29 features, I had to migrate Android project to target and compile using Android 10. Of course it meant also moving out of all those support libraries to AndroidX. A lot of initial problems but eventually it also compiled and it is working well. Then I updated to XF 5.0 and it went surprisingly smooth :)

Now, as the last update, I'd like to change the C# version the project uses from 7.3 to 8.0. Apparently, if you set your project to target .Net Standard 2.1, it will use C# 8 by default. And so I did that and I was finally able to use default interface methods - well, kind of, as the compiler stopped underlining it saying it's not available, but when I'm rebuilding my solution I'm getting Metadata file '..\bin\Debug\netstandard2.1\App.dll' could not be found error.. What's wrong? Does XF handle .Net Standard 2.1? Of course, I tried restarting VS, rebuilding and clearing obj/bin/vs folders (many times)

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,375 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,026 Reputation points
    2021-11-24T21:54:02.76+00:00

    there is a site for .netstandard compatibility

    https://dotnet.microsoft.com/platform/dotnet-standard#versions

    it says to support 2.1, you need xamarin.android version 10 (you may need a current patched version of visual studio).

    I believe Xamarin forms is dead and replaced by Maui Forms which is supported by net 6. You might just want to upgrade.

    note: the version of C# is now dependent on the .net core runtime.

    net standard 2.0 up to C# 7.3
    net standard 2.1 up to C# 8 (last .net standard version)
    core 3.1 up to C# 8.0
    net 5 up to C# 9.0
    net 6 up to C#10