-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Versioning my Maui Android App raise multiple errors #3690
Comments
Same problem here |
Repro on Version 17.2.0 Preview 2.0 [32216.282.main] and the above project. |
Hi @Bronzato1. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
I have VS 2022 RC, and in a MAUI new app by simply changing the version number in the project file, it creates fatal errors. The error in this case was: Error NETSDK1005 |
It looks like changing See: |
Fixes: dotnet#3690 Fixes: dotnet#6626 Changing `$(ApplicationDisplayVersion)` inside Visual Studio causes builds to fail: Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element You get this error once per `TargetFramework`. Builds outside VS work fine! `dotnet build` succeeds. I was able to attach a debugger to VS, and hit a breakpoint on this line in NuGet: https://github.com/NuGet/NuGet.Client/blob/82630f7f8fb5114a207c295f2f9bea1bc2a6b3cf/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsSolutionRestoreService.cs#L227 With a stack trace of: This exception was originally thrown at this call stack: System.Linq.Enumerable.SingleOrDefault<TSource>(System.Collections.Generic.IEnumerable<TSource>) NuGet.SolutionRestoreManager.VSNominationUtilities.GetPackageVersion(System.Collections.IEnumerable) in VSNominationUtilities.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.ToPackageSpec(NuGet.VisualStudio.ProjectNames, System.Collections.IEnumerable, string, string) in VsSolutionRestoreService.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.ToDependencyGraphSpec(NuGet.VisualStudio.ProjectNames, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo2) in VsSolutionRestoreService.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.NominateProjectAsync(string, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo2, System.Threading.CancellationToken) in VsSolutionRestoreService.cs This appears to be caused by an issue with NuGet inside Visual Studio: NuGet/Home#6461 If you get a different `$(PackageVersion)` for any TF, you run into this. It appears we set `$(Version)` based off of `$(ApplicationDisplayVersion)` in all of the mobile workloads: Android, MacCatalyst, iOS, etc. Then `$(PackageVersion)` is also based on `$(Version)`. * https://github.com/xamarin/xamarin-android/blob/d4da1c252f45c4910abc1bd9e5be9ecf9dc683a0/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets#L114 * https://github.com/xamarin/xamarin-macios/blob/b84b80902c91cc99e88aac734761c9d0d99ce42f/dotnet/targets/Xamarin.Shared.Sdk.targets#L7 Except when using MAUI for net6.0-windows. To workaround this issue, we can put the same code in `WinUI.targets`: <Version Condition=" '$(ApplicationDisplayVersion)' != '' ">$(ApplicationDisplayVersion)</Version> This seems reasonable for our WinUI support in MAUI anyway, as we have code that makes `$(ApplicationDisplayVersion)` work there.
…6628) Fixes: #3690 Fixes: #6626 Changing `$(ApplicationDisplayVersion)` inside Visual Studio causes builds to fail: Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element Error NU1105 Unable to read project information for 'MauiApp15': Sequence contains more than one element You get this error once per `TargetFramework`. Builds outside VS work fine! `dotnet build` succeeds. I was able to attach a debugger to VS, and hit a breakpoint on this line in NuGet: https://github.com/NuGet/NuGet.Client/blob/82630f7f8fb5114a207c295f2f9bea1bc2a6b3cf/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsSolutionRestoreService.cs#L227 With a stack trace of: This exception was originally thrown at this call stack: System.Linq.Enumerable.SingleOrDefault<TSource>(System.Collections.Generic.IEnumerable<TSource>) NuGet.SolutionRestoreManager.VSNominationUtilities.GetPackageVersion(System.Collections.IEnumerable) in VSNominationUtilities.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.ToPackageSpec(NuGet.VisualStudio.ProjectNames, System.Collections.IEnumerable, string, string) in VsSolutionRestoreService.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.ToDependencyGraphSpec(NuGet.VisualStudio.ProjectNames, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo2) in VsSolutionRestoreService.cs NuGet.SolutionRestoreManager.VsSolutionRestoreService.NominateProjectAsync(string, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo, NuGet.SolutionRestoreManager.IVsProjectRestoreInfo2, System.Threading.CancellationToken) in VsSolutionRestoreService.cs This appears to be caused by an issue with NuGet inside Visual Studio: NuGet/Home#6461 If you get a different `$(PackageVersion)` for any TF, you run into this. It appears we set `$(Version)` based off of `$(ApplicationDisplayVersion)` in all of the mobile workloads: Android, MacCatalyst, iOS, etc. Then `$(PackageVersion)` is also based on `$(Version)`. * https://github.com/xamarin/xamarin-android/blob/d4da1c252f45c4910abc1bd9e5be9ecf9dc683a0/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets#L114 * https://github.com/xamarin/xamarin-macios/blob/b84b80902c91cc99e88aac734761c9d0d99ce42f/dotnet/targets/Xamarin.Shared.Sdk.targets#L7 Except when using MAUI for net6.0-windows. To workaround this issue, we can put the same code in `WinUI.targets`: <Version Condition=" '$(ApplicationDisplayVersion)' != '' ">$(ApplicationDisplayVersion)</Version> This seems reasonable for our WinUI support in MAUI anyway, as we have code that makes `$(ApplicationDisplayVersion)` work there.
Description
Previously the way to define version code for Android in Maui .csproj file was like this:
With the new release of Visual Studio Preview, this has changed to:
It works, from Visual Studio, I can bundle a new .aab package (see image below). We see the version code is defined to 3. Unfortunately the version is defined to 1.0.0.
...when imported on the Google Play Console, it look like this:
Unfortunately, when imported on the Google Play Console I only see the versionCode 3 (which is defined in the .csproj file as ApplicationVersion). What about the versionName (in parentheses) ? Nothing is planned in the .csproj file ? When imported on the Google Play Console, I don't want to have 3 (1.0.0) but I want 3 (3.1.2)...
https://developer.android.com/studio/publish/versioning
versionCode — A positive integer used as an internal version number.
versionName — A string used as the version number shown to users.
Someone suggested me to update my csproj file by adding:
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
or manually set in your androidmanifest.xml:
https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNetSingleProject.md
By adjusting my csproj file to add ApplicationDisplayVersion it raise me multiple errors:
Is this a bug ?
As soon as I remove this code in my csproj file, the errors disappeared.
I'm using Visual Studio Professional 2022 - Preview Version 17.1.0 Preview 1.1
I did a
maui-check
Steps to Reproduce
By adjusting my csproj file to add ApplicationDisplayVersion it raise me multiple errors:
Version with bug
Visual Studio Professional 2022 - Preview Version 17.1.0 Preview 1.1
Maui Preview 10
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
OS: Windows 10 - Visual Studio Professional 2022 - Preview Version 17.1.0 Preview 1.1
Did you find any workaround?
Manually set inside my AndroidManifest.xml do the trick.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: