-
Notifications
You must be signed in to change notification settings - Fork 556
Description
When building a .NET 9 iOS project using Microsoft.iOS.Sdk.net9.0_18.5, the build succeeds once, but subsequent rebuilds fail with the error:
The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long.
Reproduction Steps:
- Create a new iOS project targeting net9.0-ios.
- Set explicit version properties in .csproj:
<ApplicationVersion>1.0</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
- Build the project (succeeds).
- Rebuild the project (fails with the error above).
Environment:
• .NET SDK: 9.0
• iOS SDK: Microsoft.iOS.Sdk.net9.0_18.5 (C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.5\18.5.9214\targets\Xamarin.Shared.Sdk.targets)
• Visual Studio 2022
• TargetFramework: net9.0-ios
• OS: Windows
Additional Info:
• The error appears to originate from line 2344 in Xamarin.Shared.Sdk.targets.
• Info.plist contains valid version strings.
• No direct usage of Version.Parse in user code.
• Cleaning and rebuilding sometimes resolves the issue temporarily.
Expected Behavior:
Rebuilds should succeed consistently when version properties are set.
Actual Behavior:
Rebuild fails with a version parsing error.