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

Uno.Sdk (5.2 templates) only allows ApplicationDisplayVersion value 1.0 #16618

Open
BrianDT opened this issue May 7, 2024 · 5 comments
Open
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@BrianDT
Copy link

BrianDT commented May 7, 2024

Current behavior

If ApplicationDisplayVersion is set to anything other than 1.0 the build will fail to resolve Uno and other references.

    <!-- Versions -->
    <ApplicationDisplayVersion>5.0.21</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>

Results in

Build started at 20:21...
1>------ Build started: Project: Templates_5_2, Configuration: Debug Any CPU ------
Failed to restore D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\Templates_5_2.csproj (in 0.4 ms).
Failed to restore D:\Development\Samples\Uno\Templates_5_2\Templates_5_2.Tests\Templates_5_2.Tests.csproj (in 16 ms).
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0-android'. Ensure that restore has run and that you have included 'net8.0-android' in the TargetFrameworks for your project.
1>Done building project "Templates_5_2.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0-ios'. Ensure that restore has run and that you have included 'net8.0-ios' in the TargetFrameworks for your project.
1>Done building project "Templates_5_2.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0-windows10.0.19041'. Ensure that restore has run and that you have included 'net8.0-windows10.0.19041' in the TargetFrameworks for your project.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0-maccatalyst'. Ensure that restore has run and that you have included 'net8.0-maccatalyst' in the TargetFrameworks for your project.
1>Done building project "Templates_5_2.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\obj\project.assets.json' doesn't have a target for 'net8.0-browserwasm'. Ensure that restore has run and that you have included 'net8.0-browserwasm' in the TargetFrameworks for your project.
1>Done building project "Templates_5_2.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 20:21 and took 00.484 seconds ==========

Expected behavior

Should be the same as

    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>
Build started at 20:26...
1>------ Build started: Project: Templates_5_2, Configuration: Debug Any CPU ------
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0-windows10.0.19041\Templates_5_2.dll
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0\Templates_5_2.dll
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0-ios\iossimulator-x64\Templates_5_2.dll
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0-maccatalyst\maccatalyst-x64\Templates_5_2.dll
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0-browserwasm\Templates_5_2.dll
1>Templates_5_2 -> D:\Development\Samples\Uno\Templates_5_2\Templates_5_2\bin\Debug\net8.0-android\Templates_5_2.dll
1>obj\Debug\net8.0-android\android\AndroidManifest.xml : warning XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-34\optional\androidx.window.extensions.jar
1>obj\Debug\net8.0-android\android\AndroidManifest.xml : warning XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-34\optional\androidx.window.sidecar.jar
1>Done building project "Templates_5_2.csproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 20:26 and took 50.626 seconds ==========

How to reproduce it (as minimally and precisely as possible)

Reproduce by creating a new solution and project from the Uno Platform App template and just change the ApplicationDisplayVersion.

Wait for all the dependencies to error and then build.

Workaround

Keep the ApplicationDisplayVersion as 1.0, however this becomes a significant issue when you need to release a new build of an existing product.

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

"Uno.Sdk": "5.2.108"

Affected platforms

WebAssembly, Android, iOS, Mac Catalyst, Windows (WinAppSDK)

IDE

Visual Studio 2022

IDE version

17.9.6

Relevant plugins

No response

Anything else we need to know?

No response

@BrianDT BrianDT added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels May 7, 2024
@dansiegel
Copy link
Contributor

This is certainly strange. The Uno.Sdk doesn't actually handle this property at all, it's all the underlying Microsoft Sdk's for Android/iOS/MacCatalyst that handle this.

@jeromelaban
Copy link
Member

The error is flagged in VS only, and is reported as follows :

error NU1105: Unable to read project information for 'UnoApp1': The property PackageVersion was expected to have a single 
value across all target frameworks, but instead had the following values: 1.0.0, 5.0.2

This would indicate that something is changing PackageVersion through the change of ApplicationDisplayVersion.

@jeromelaban
Copy link
Member

This is likely caused by https://github.com/xamarin/xamarin-android/blob/98c10631d6bd67d6fab70ebab041abb47141daaf/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets#L132, which sets Version which likely sets PackageVersion as the fallback value.

We probably should be setting the same version for all app heads.

@mikernet
Copy link
Contributor

Is there a workaround for this?

@jeromelaban
Copy link
Member

@mikernet yes, you can set the Version property to the same value. This is what the fix will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

4 participants