Xamarin iOS:错误 MSB4018:"CompileITunesMetadata" 任务意外失败
Xamarin iOS: error MSB4018: The "CompileITunesMetadata" task failed unexpectedly
将我们的 iOS 构建服务器从 Mac OS Catalina 更新到 Big Sur 后,我们的 GitLab 管道 (运行 cakebuild) 因一些神秘问题而失败一个特定项目的 Xamarin 特定错误消息(意味着其他 Xamarin iOS 项目正在成功构建并通过管道)。
然而,在不同的 Big Sur 机器上检查完全相同的项目(相同的提交,相同的一切),有问题的项目编译没有错误。请注意,即使之前通过的提交现在也无法通过管道。
这是日志中有趣的部分
"/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (Build target) (1) ->
(_CompileITunesMetadata target) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: The "CompileITunesMetadata" task failed unexpectedly. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: System.ArgumentException: Path cannot be the empty string or all whitespace. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: Parameter name: path [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at System.IO.Directory.CreateDirectory (System.String path) [0x00016] in <92218043474744ea9d64d27064c35dcb>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadataTaskBase.Execute () [0x001ed] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadata.Execute () [0x0002a] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,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) [0x002b9] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
63 Warning(s)
1 Error(s)
Time Elapsed 00:01:16.38
An error occurred when executing task 'Build'.
Error: One or more errors occurred. (MSBuild: Process returned an error (exit code 1).)
MSBuild: Process returned an error (exit code 1).
Cleaning up file based variables
00:00
ERROR: Job failed: exit status 1
我们不会根据要求添加任何可能不相关的随机代码片段(.csproj
、info.plist
),因为我们完全不知道可能的原因是什么是。
如果您遇到此问题或任何类似问题,我们将不胜感激。
编辑添加更详细的日志
Target "_CompileITunesMetadata: (TargetId:343)" in file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets" from project "/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (target "_CreateAppBundle" depends on it):
Building target "_CompileITunesMetadata" completely.
Output file "build-outputiTunesMetadata.plist" does not exist.
Using "CompileITunesMetadata" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/../iOS/Xamarin.iOS.Tasks.dll".
Task "CompileITunesMetadata" (TaskId:232)
Task Parameter:AppBundleDir=build-outputClubmappAppIOS.app (TaskId:232)
Task Parameter:OutputPath=build-outputiTunesMetadata.plist (TaskId:232)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: The "CompileITunesMetadata" task failed unexpectedly. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: System.ArgumentException: Path cannot be the empty string or all whitespace. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: Parameter name: path [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at System.IO.Directory.CreateDirectory (System.String path) [0x00016] in <92218043474744ea9d64d27064c35dcb>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadataTaskBase.Execute () [0x001ed] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadata.Execute () [0x0002a] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,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) [0x002b9] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
Done executing task "CompileITunesMetadata" -- FAILED. (TaskId:232)
Done building target "_CompileITunesMetadata" in project "ClubmappAppIOS.csproj" -- FAILED.: (TargetId:343)
Done Building Project "/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (Build target(s)) -- FAILED.
所以 msbuild 似乎无法找到名为 build-outputiTunesMetadata.plist
的文件,但是 documentation 指出该文件是可选的。
To supply the missing information to an Ad Hoc distribution, an optional iTunesMetadata.plist file can be created and included in the applications IPA file. This plist file is a specially formatted XML file (see Apple's Property List Programming Guide for more information) that contains key/value pairs defining information about a given iOS application.
编辑 2:
似乎在 Xamarin iOS msbuild 代码中抛出异常 here:
Directory.CreateDirectory (Path.GetDirectoryName (OutputPath.ItemSpec));
其中 OutputPath.ItemSpec
的值是 "build-outputiTunesMetadata.plist"
,如日志中所示。然后将此文件名传递给 Path.GetDirectoryName()
,可能 returns ""
(因为此字符串中没有路径,只有文件名)。然后它尝试创建一个名为 ""
的目录,结果产生 System.ArgumentException: Path cannot be the empty string or all whitespace.
。
现在我们该如何解决呢?这个build-outputiTunesMetadata.plist
文件的Path/Name指定在哪里?
我们昨天终于关闭了这个错误票,虽然问题真的不是太明显。
回到 .NET 5 发布时,我们手动将 msbuild.dll 从 Visual Studio 链接到 Mac,以便在单声道编译中使用。因此,我们的 cakebuild 构建脚本过去看起来像这样:
MSBuild(projectFilePath, settings =>
{
settings.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Diagnostic)
.WithTarget("Build")
.WithProperty("Platform", "iPhone")
.WithProperty("BuildIpa", "true")
.WithProperty("OutputPath", buildResultDir + System.IO.Path.DirectorySeparatorChar)
.WithProperty("TreatWarningsAsErrors", "false");
settings.ToolPath = new FilePath("/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll");
});
(注意我们是如何在 build-output
目录后附加 System.IO.Path.DirectorySeparatorChar
的).
现在由于某些原因这个/
在编译过程中被忽略了,意思是msbuild直接合并了目录名build-output
和文件名(例如iTunesMetadata.plist
)。
由于构建脚本在 之前 更新 Mac OS、XCode 和 [=41= 的 Visual Studio ] 构建服务器的实例,我们删除了手动指定的 MSBuild.dll
实例,它解决了手头的问题,并且由于单声道现在已经构建了对 .NET 5 的支持,我们无论如何都不需要这个解决方法。
因此,我们当前的构建脚本如下所示:
MSBuild(projectFilePath, settings =>
{
settings.SetConfiguration(configuration)
.WithTarget("Build")
.WithProperty("Platform", "iPhone")
.WithProperty("BuildIpa", "true")
.WithProperty("OutputPath", buildResultDir + System.IO.Path.DirectorySeparatorChar)
.WithProperty("TreatWarningsAsErrors", "false");
});
这是一个有趣的行为,尽管它只是随机开始忽略尾随 Path.DirectorySeparatorChar
:shrug:
将我们的 iOS 构建服务器从 Mac OS Catalina 更新到 Big Sur 后,我们的 GitLab 管道 (运行 cakebuild) 因一些神秘问题而失败一个特定项目的 Xamarin 特定错误消息(意味着其他 Xamarin iOS 项目正在成功构建并通过管道)。
然而,在不同的 Big Sur 机器上检查完全相同的项目(相同的提交,相同的一切),有问题的项目编译没有错误。请注意,即使之前通过的提交现在也无法通过管道。
这是日志中有趣的部分
"/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (Build target) (1) ->
(_CompileITunesMetadata target) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: The "CompileITunesMetadata" task failed unexpectedly. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: System.ArgumentException: Path cannot be the empty string or all whitespace. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: Parameter name: path [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at System.IO.Directory.CreateDirectory (System.String path) [0x00016] in <92218043474744ea9d64d27064c35dcb>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadataTaskBase.Execute () [0x001ed] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadata.Execute () [0x0002a] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,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) [0x002b9] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
63 Warning(s)
1 Error(s)
Time Elapsed 00:01:16.38
An error occurred when executing task 'Build'.
Error: One or more errors occurred. (MSBuild: Process returned an error (exit code 1).)
MSBuild: Process returned an error (exit code 1).
Cleaning up file based variables
00:00
ERROR: Job failed: exit status 1
我们不会根据要求添加任何可能不相关的随机代码片段(.csproj
、info.plist
),因为我们完全不知道可能的原因是什么是。
如果您遇到此问题或任何类似问题,我们将不胜感激。
编辑添加更详细的日志
Target "_CompileITunesMetadata: (TargetId:343)" in file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets" from project "/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (target "_CreateAppBundle" depends on it):
Building target "_CompileITunesMetadata" completely.
Output file "build-outputiTunesMetadata.plist" does not exist.
Using "CompileITunesMetadata" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/../iOS/Xamarin.iOS.Tasks.dll".
Task "CompileITunesMetadata" (TaskId:232)
Task Parameter:AppBundleDir=build-outputClubmappAppIOS.app (TaskId:232)
Task Parameter:OutputPath=build-outputiTunesMetadata.plist (TaskId:232)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: The "CompileITunesMetadata" task failed unexpectedly. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: System.ArgumentException: Path cannot be the empty string or all whitespace. [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: Parameter name: path [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at System.IO.Directory.CreateDirectory (System.String path) [0x00016] in <92218043474744ea9d64d27064c35dcb>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadataTaskBase.Execute () [0x001ed] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Xamarin.iOS.Tasks.CompileITunesMetadata.Execute () [0x0002a] in <5fc761670f214242b2d9c8c4b0525b32>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(320,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) [0x002b9] in <6f1ac64b362443459ae7e79676b4c67f>:0 [/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj]
Done executing task "CompileITunesMetadata" -- FAILED. (TaskId:232)
Done building target "_CompileITunesMetadata" in project "ClubmappAppIOS.csproj" -- FAILED.: (TargetId:343)
Done Building Project "/Users/build/builds/Hh9r4va7/0/ClubMapp/application/ClubmappSolution/ClubmappAppIOS/ClubmappAppIOS.csproj" (Build target(s)) -- FAILED.
所以 msbuild 似乎无法找到名为 build-outputiTunesMetadata.plist
的文件,但是 documentation 指出该文件是可选的。
To supply the missing information to an Ad Hoc distribution, an optional iTunesMetadata.plist file can be created and included in the applications IPA file. This plist file is a specially formatted XML file (see Apple's Property List Programming Guide for more information) that contains key/value pairs defining information about a given iOS application.
编辑 2:
似乎在 Xamarin iOS msbuild 代码中抛出异常 here:
Directory.CreateDirectory (Path.GetDirectoryName (OutputPath.ItemSpec));
其中 OutputPath.ItemSpec
的值是 "build-outputiTunesMetadata.plist"
,如日志中所示。然后将此文件名传递给 Path.GetDirectoryName()
,可能 returns ""
(因为此字符串中没有路径,只有文件名)。然后它尝试创建一个名为 ""
的目录,结果产生 System.ArgumentException: Path cannot be the empty string or all whitespace.
。
现在我们该如何解决呢?这个build-outputiTunesMetadata.plist
文件的Path/Name指定在哪里?
我们昨天终于关闭了这个错误票,虽然问题真的不是太明显。 回到 .NET 5 发布时,我们手动将 msbuild.dll 从 Visual Studio 链接到 Mac,以便在单声道编译中使用。因此,我们的 cakebuild 构建脚本过去看起来像这样:
MSBuild(projectFilePath, settings =>
{
settings.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Diagnostic)
.WithTarget("Build")
.WithProperty("Platform", "iPhone")
.WithProperty("BuildIpa", "true")
.WithProperty("OutputPath", buildResultDir + System.IO.Path.DirectorySeparatorChar)
.WithProperty("TreatWarningsAsErrors", "false");
settings.ToolPath = new FilePath("/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll");
});
(注意我们是如何在 build-output
目录后附加 System.IO.Path.DirectorySeparatorChar
的).
现在由于某些原因这个/
在编译过程中被忽略了,意思是msbuild直接合并了目录名build-output
和文件名(例如iTunesMetadata.plist
)。
由于构建脚本在 之前 更新 Mac OS、XCode 和 [=41= 的 Visual Studio ] 构建服务器的实例,我们删除了手动指定的 MSBuild.dll
实例,它解决了手头的问题,并且由于单声道现在已经构建了对 .NET 5 的支持,我们无论如何都不需要这个解决方法。
因此,我们当前的构建脚本如下所示:
MSBuild(projectFilePath, settings =>
{
settings.SetConfiguration(configuration)
.WithTarget("Build")
.WithProperty("Platform", "iPhone")
.WithProperty("BuildIpa", "true")
.WithProperty("OutputPath", buildResultDir + System.IO.Path.DirectorySeparatorChar)
.WithProperty("TreatWarningsAsErrors", "false");
});
这是一个有趣的行为,尽管它只是随机开始忽略尾随 Path.DirectorySeparatorChar
:shrug: