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

Upgrading a Xamarin Android project is nowhere similar to the new NET6 Android app #923

Open
1 task
manuelelucchi opened this issue Nov 10, 2021 · 15 comments
Assignees
Labels
area:Maui community reported Triaged Label to show that UA team has triaged this issue.

Comments

@manuelelucchi
Copy link

  • Include the log file upgrade-assistant.clef that is produced in the working directory

Describe the bug

When upgrading a Xamarin Android project (even the default template) the csproj will be bloated of unneeded things and there will be errors with the nuget packages (also, it will upgrade it to net6, not net6-android). If you compare it with the NET6 Android app, you'll notice the template just doesn't use any nuget at all and the csproj is much smaller. Plus, the namespaces are different.

To Reproduce

Create a Xamarin Android default project and use the tool on it (doing all the steps). You can also compare the result with the NET6 Android template

Exceptions (if any)

Further technical details

  • Windows version and bitness info (32-bit or 64-bit)
  • Include the output of dotnet --list-sdks
    5.0.403 [C:\Program Files\dotnet\sdk]
    6.0.100 [C:\Program Files\dotnet\sdk]
  • Include the output of upgrade-assistant --version
    0.3.255803+d72527aefab54bfbadc3227b4f1ffd326c1e9a8a
@sunandabalu
Copy link
Member

@Sweekriti91 Is this something you could help with?

@sunandabalu sunandabalu added the Triaged Label to show that UA team has triaged this issue. label Nov 11, 2021
@twsouthwick
Copy link
Member

This is not supported yet. The conversion from Xamarin Android -> Maui will be supported by the time .NET Maui is released.

How are you performing the conversion? Are you using the .NET Maui preview extension?

@manuelelucchi
Copy link
Author

Not really. I just created a template and called the command I just installed. But why isn't it supported?
Xamarin Forms ->.NET Maui
Xamarin Android ->.NET Android
That would be the preferred way. Also, it shuold be easier for you, shouldn't it?

@fdhsdrdark
Copy link

@manuelelucchi

After installing Visual Studio 2022
I am also in the process of upgrading
Xamarin Android -> .Net Android and also
Xamarin iOS -> .Net iOS

Quick Question:
When creating a brand new Xamarin Android app from the template, on the csproj where can you see the "net6-android" actually beeing used?

@manuelelucchi
Copy link
Author

@nikossaperas when you create a xamarin android app from template you don't have net6, it's still modo with franken-proj. You have to use the Net6 android preview templates (they come with Maui iirc)

@Sweekriti91
Copy link
Contributor

Hi @nikossaperas and @manuelelucchi,

.NET MAUI is the next evolution of Xamarin. You can find more detailed explanation of the difference and roadmap here. The updated timeline for the release of .NET MAUI RC is explained here.

At the moment, upgrade-assistant has a preview of migration support for Xamarin.Forms to .NET MAUI (not single project, current it is done by maintaining the project heads). The migration process in the tool right now is incomplete and will actually be completed closer to the release of .NET MAUI. We also plan to add support to allow XF -> Single Project .NET MAUI project, but again this support is coming soon, it is not implemented at the moment.

Xamarin Forms ->.NET Maui
Xamarin Android ->.NET6 Android
Xamarin.iOS -> .NET6 iOS

This is the planned approach and we will be adding support for these migration paths to upgrade-assistant, and this support is coming soon.

When creating a brand new Xamarin Android app from the template, on the csproj where can you see the "net6-android" actually beeing used?

Depending on which Project type you choose, the templates are different. If you search for templates for .NET MAUI, that will create a .NET MAUI Single project experience that targets net6-android. If you use the Xamarin templates, they will use the Xamarin templates. If you are not able to see the MAUI templates in VS2022, you want to make sure you have followed the installation steps here and also confirm you have the .NET MAUI workloads installed via the dotnet CLI tool.

For more updated information and migration guides, you can follow the .NET MAUI GitHub, specifically checkout the Wiki.

I hope this helps provide some clarity!

@fdhsdrdark
Copy link

@Sweekriti91 Thank you very much for all the info and clarifications.
I misinterpreted a video I recently watched (this one actually https://www.youtube.com/watch?v=X2zhvJXEXjE) and thought the upgrade assistant is now ready to use.

Thanks for all the effort!

@manuelelucchi
Copy link
Author

@Sweekriti91 so the support for migrating non forms project is coming, cool. It wasn't really clear if it was supported or not. Thank you

@mgierlasinski
Copy link

One year later, upgrading File->New Xamarin.Android project looks like this:
image

This is bad, @Sweekriti91 is this on your roadmap?

@cybvitthal
Copy link

Does upgrade-assistant supports migrating from Xamarin.Android to net7.0-android and Xamarin.iOS to net7.0-ios yet ?

@fdhsdrdark
Copy link

Currently on the painful process of migrating from Xamarin.Android to net7.0-android and Xamarin.iOS to net7.0
According to this https://github.com/xamarin/xamarin-android/wiki/Migrating-Xamarin.Android-Applications-to-.NET-6
and my experience up to now, the easiest way is to create a new project from the new template and copy everything over.
Bear in mind that not all Nuget packages can be used with net7.0. So, for anyone landing here - maybe start with a new project based on the new templates, add the packages and then the files.

@jstedfast
Copy link
Member

@fdhsdrdark The upgrade assistant should correctly migrate from Xamarin.Android to net7.0-android now.

@fdhsdrdark
Copy link

@jstedfast Maybe my project was a bit complicated, so I followed the 'manual' migration path, also described here for anyone on the same page: https://devblogs.microsoft.com/xamarin/upgrade-xamarin-ios-android-to-dotnet6-dotnet7/
But, yeah - if upgrade assistant correctly migrates, perfect!

@jstedfast
Copy link
Member

If it doesn't migrate your project, we'd love to know what failed so we can fix it and/or add more logic to tackle things that it could do better.

@fdhsdrdark
Copy link

@jstedfast I took the suggested manual approach for Android and managed to complete the migration. Now iOS remains, seems trickier. Regardless of outcome/approach, kudos for replying and most important for positive attitude on supporting Xamarin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Maui community reported Triaged Label to show that UA team has triaged this issue.
Projects
None yet
Development

No branches or pull requests

9 participants