Skip to content

ReadApiCompatibilityLevel of NuGetForUnity.Cli/Fakes /Application.cs always returns apiCompatibilityLevel and never apiCompatibilityLevelPerPlatform #668

@Flauschelin

Description

@Flauschelin

The apiCompatibilityLevelPerPlatform is never returned when using CLI

  • NuGetForUnity Version: Master branch
  • Unity Version: 2020.3.48f1
  • Operating System: Windows

To me it looks like the Method ReadApiCompatibilityLevel(string projectPath) will returns as soon as it found the textline "apiCompatibilityLevel:" and was able to parse the integer value.

if (trimmedLine.StartsWith(apiCompatibilityLevelConfigName, StringComparison.OrdinalIgnoreCase))
{
    var stringValue = trimmedLine[apiCompatibilityLevelConfigName.Length..].Trim();
    if (int.TryParse(stringValue, out var value))
    {
        return value;
    }
}

However, it finds and parse the "apiCompatibilityLevelPerPlatform:" entries as well, but at least my Unity always includes the general "apiCompatibilityLevel:" at the end of the ProjectSettings.asset file.

I would suggest not to return immediately, but instead keep the value and only use it in case no "PerPlatform" value has been found.
It would also be good if we could specify the platform.

What seems also strange is the decision which .NET version should be used:
return perPlatformConfig.Values.Max();
.NET2.x has the integer value 6 and and .NET4.x has a integer of 3. So Max() would return .NET2.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions