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

[Bug] Build failure. Invalid iOS version #4091

Closed
VladislavAntonyuk opened this issue Apr 18, 2023 · 12 comments · Fixed by #4093
Closed

[Bug] Build failure. Invalid iOS version #4091

VladislavAntonyuk opened this issue Apr 18, 2023 · 12 comments · Fixed by #4093

Comments

@VladislavAntonyuk
Copy link

Logs and network traces
Without logs or traces, it is unlikely that the team can investigate your issue. Capturing logs and network traces is described in Logging wiki.

Which version of MSAL.NET are you using?

4.53.0

Platform

net7.0-ios

Repro

https://github.com/VladislavAntonyuk/MauiSamples/tree/main/Auth/MauiAuth

Expected behavior
No build issue.

Actual behavior
Error CS1705 Assembly 'Microsoft.Identity.Client' with identity 'Microsoft.Identity.Client, Version=4.53.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' uses 'Microsoft.iOS, Version=16.4.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' which has a higher version than referenced assembly 'Microsoft.iOS' with identity 'Microsoft.iOS, Version=16.2.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

Possible solution
Downgrade to 4.52.0

Additional context / logs / screenshots / links to code
The latest available version of iOS Sdk is 16.2: https://github.com/xamarin/xamarin-macios/blob/main/DOWNLOADS.md

@gladjohn
Copy link
Contributor

gladjohn commented Apr 18, 2023

HI @VladislavAntonyuk, I am not sure about the Microsoft.iOS, Version=16.4.0.0 error in Microsoft.Identity.Client, Version=4.53.0.0 , MSAL 4.53.0 uses net6.0-ios15.4

@VladislavAntonyuk
Copy link
Author

VladislavAntonyuk commented Apr 18, 2023

Hi @gladjohn!
My target framework is net7.0-ios.
I tried with net7.0-ios15.4 and got the same error.
The same issue is on CI.

@pmaytak
Copy link
Contributor

pmaytak commented Apr 18, 2023

So I think the app does have to target specific iOS version, like net7.0-ios16.2. Otherwise net7.0-ios will end up picking up net6.0 MSAL binaries. In 4.53.0 we haven't made any changes that would affect the TFMs. When rebuilding as net7.0-ios16.2, is environment clean, and all previous cached bin/obj folders erased? Maybe VS is picking up some old files.

@VladislavAntonyuk
Copy link
Author

@pmaytak I uses net7.0-ios without specifying version.
The issue is reproducing on CI so I assume the env is clean.
Could you reproduce the issue from the link I provided?

@gladjohn
Copy link
Contributor

@VladislavAntonyuk we are able to repro the issue. We will update once we find the root cause or if we have a workaround or a fix

@VladislavAntonyuk
Copy link
Author

@gladjohn is there a nightly generated package available, so I can check if the is fixed?

@VladislavAntonyuk
Copy link
Author

VladislavAntonyuk commented May 11, 2023

@gladjohn, @pmaytak seems like the issue is not fixed. Could you please reopen it?

@pmaytak pmaytak reopened this May 11, 2023
@pmaytak pmaytak modified the milestones: 4.54.0, 4.55.0 May 11, 2023
@pmaytak
Copy link
Contributor

pmaytak commented May 11, 2023

@VladislavAntonyuk 16.4 was released 2 days ago. https://www.nuget.org/packages/Microsoft.iOS.Sdk/#versions-body-tab
We verified that our nightly builds were using 16.2 until 2 days ago too.

Can you try updating the iOS MAUI workloads on your machine?

@VladislavAntonyuk
Copy link
Author

if .net 8 is installed, VS or dotnet workload install ios installs version 16.2.462-net8-p3.
it works with .net 7.

@baskren
Copy link

baskren commented Jul 11, 2023

@VladislavAntonyuk : Thank you for the tip (dotnet workload install ios). Spent many hours until I found your recommendation.

@AnithaRaniT
Copy link

AnithaRaniT commented Sep 12, 2023

@VladislavAntonyuk, @pmaytak, @gladjohn I'm also facing the same issue as,

Severity Code Description Project File Line Suppression State
Error CS1705 Assembly 'Microsoft.Identity.Client' with identity 'Microsoft.Identity.Client, Version=4.54.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' uses 'Microsoft.iOS, Version=16.4.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' which has a higher version than referenced assembly 'Microsoft.iOS' with identity 'Microsoft.iOS, Version=16.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' AppCore (net7.0-android)

What I tried:
--Update the work loads using dotnet workload install ios and dotnet workload install maui
--Cleaned, rebuild
--Changed the version of Microsoft.Identity.Client from 4.54.1 to "4.52.0"
--and here is the csproj:

<PropertyGroup>
	<TargetFrameworks>net7.0-android;net7.0-ios;</TargetFrameworks>
	<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
	<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
	<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
	<UseMaui>true</UseMaui>
	<SingleProject>true</SingleProject>
	<ImplicitUsings>enable</ImplicitUsings>

	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
	<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>-->
	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
	<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
	<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
	<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>-->
</PropertyGroup>

<ItemGroup>
  <Compile Remove="Platforms\Android\Dependencies\ShareController.cs" />
</ItemGroup>

<ItemGroup>
  <None Remove="AppSettings\AppSettings.json" />
  <None Remove="AppSettings\AppSettings_Prod.json" />
  <None Remove="AppSettings\AppSettings_Stage.json" />
</ItemGroup>

<ItemGroup>
  <EmbeddedResource Include="AppSettings\AppSettings.json" />
  <EmbeddedResource Include="AppSettings\AppSettings_Prod.json" />
  <EmbeddedResource Include="AppSettings\AppSettings_Stage.json" />
</ItemGroup>

<ItemGroup>
  <PackageReference Include="Microsoft.AppCenter" Version="5.0.2" />
  <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.2" />
  <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.2" />
  <PackageReference Include="Microsoft.Identity.Client" Version="4.54.1" />
  <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
  <PackageReference Include="Polly" Version="8.0.0-alpha.5" />
  <PackageReference Include="Prism.Maui" Version="8.1.273-pre" />
<!--<PackageReference Include="AppDynamics.Agent.Maui" Version="2023.2.0"/>-->
false

@pmaytak
Copy link
Contributor

pmaytak commented Sep 12, 2023

The original issue was that MSAL included Microsoft.iOS 16.4 which was a preview version at the time. As of now Microsoft.iOS 16.4 is public stable. So this seems like a different issue.

Some things to try:

  • Include an explicit reference to the latest Microsoft.iOS.SDK package.
  • Target net7.0-ios15.4.
  • Make sure you have the latest .NET 7 SDK installed, then run dotnet workload install ios.
  • Install the latest .NET SDK and install workloads again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment