Skip to content

[System.Version]::Parse('') error during rebuild with .NET 9 iOS SDK #23927

@arivoir

Description

@arivoir

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:

  1. Create a new iOS project targeting net9.0-ios.
  2. Set explicit version properties in .csproj:
<ApplicationVersion>1.0</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
  1. Build the project (succeeds).
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions