Skip to content

[msbuild] Don't ship the same Xamarin.Localization.MSBuild.dll for both Xamarin.iOS and Xamarin.Mac #9830

@rolfbjarne

Description

@rolfbjarne

We ship Xamarin.Localization.MSBuild.dll for both Xamarin.iOS and Xamarin.Mac, but this turns out problematic when users have different versions of Xamarin.iOS and Xamarin.Mac installed, and they have a solution with both Xamarin.Mac and Xamarin.iOS projects, because which Xamarin.Localization.MSBuild.dll is loaded is random, and might be out of date with the other one, ending up with errors like this:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(451,3): error MSB4018: Unerwarteter Fehler bei der DetectSdkLocations-Aufgabe.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(451,3): error MSB4018: System.MissingMethodException: Method not found: string Xamarin.Localization.MSBuild.MSBStrings.get_E0083()
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(451,3): error MSB4018:   at Xamarin.Mac.Tasks.DetectSdkLocationsTaskBase.Execute () [0x0000b] in <d017cb344f634ca38ded1ddbdf8b14c4>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(451,3): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:575 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets(451,3): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:818 

Potential solutions:

  • Use ILRepack to merge Xamarin.Localization.MSBuild.dll into the main iOS/Mac MSBuild assembly (this is what we already do for other assemblies, but due to resource loading this might not work).
  • Rename Xamarin.Localization.MSBuild.dll to Xamarin.[iOS|Mac].Localization.MSBuild.dll (this might require having two different projects).
  • Sign each version with different keys? Not sure if this would work, but it might be the simplest.

Originally posted by @tipa in https://github.com/xamarin/xamarin-macios/issue_comments/705712527

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fixiOSIssues affecting iOSmacOSIssues affecting macOSmsbuildIssues affecting our msbuild tasks/targetsregressionThe issue or pull request is a regression

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions