Everything is an error on VS2019 but not VS2017, why?

Phunction 301 Reputation points
2020-12-22T00:21:45.387+00:00

Hopefully someone can help, I have an android project, works fine with VS2017, but when I open it in VS2019 everything is red(ie: The type or namespace 'System' could not be found...).
All the references are shown with a yellow icon, unless I click on it then the icon goes away.
How do I track this down? Why does it work on 2017 but not 2019? I really need to get it to work on 2019 as 2017 is limited to Android 9.0 sdk.
I can't find any hint as to why it does not work, there is nothing in the Xamarin logs, if I try building I just get a build failed in the output window.

Developer technologies | C#
{count} votes

Accepted answer
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,756 Reputation points
    2020-12-23T06:03:48.457+00:00

    Hello,

    Welcome to Microsoft Q&A!

    xamarin.googleplayservices.maps need dependencies of AndroidX , AndroidX is a replacement to the original Android Support Library , if you install both if them in your project , there will be conflict.

    You can remove Support library and migrate to AndroidX package .

    Check the details in this article : https://learn.microsoft.com/en-us/xamarin/android/platform/androidx

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2020-12-22T07:18:03.09+00:00

    All the references are shown with a yellow icon, unless I click on it then the icon goes away.

    Then the project has none of the references to the DLL(s), like 'System' or any of the other DLL(s). I think you will need to use the Nuget's Restore feature to have the referenced DLL(s) restored to the project.

    https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore


  2. Phunction 301 Reputation points
    2020-12-22T20:27:11.377+00:00

    I removed all my nuget packages and the 'system' errors went away (still had errors that referenced the nuget packages.)
    I then install the newer version of the nuget packages, namely Android.Support.V4 and google play services.
    Now, when I first install Android.Support.V4, it is OK, however, when I then try to install xamarin.googleplayservices.maps, everything breaks again. I have to remove all nuget packages.

    Is there a problem with running Android.Support.V4 and xamarin.googleplayservices.maps together?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.