Xamarin.Mac Target _CodesignFrameworks, Codesign task failed unexpectedly, Could not find a part of the path _CodeSignature

Alan Fransham 1 Reputation point
2021-06-01T12:58:30.593+00:00

I am trying to build a Xamarin.Mac project that links to a native framework, that has started failing due to a codesign related error.

The error I am getting is:

Target "_CodesignFrameworks" in file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Shared.targets":
Building target "_CodesignFrameworks" completely.
Output file "obj/Release/codesign/ThemeKit" does not exist.
Task "Codesign"
Tool /usr/bin/codesign execution started with arguments: -v --force --timestamp=none --sign F825BA46C7556F0CAFD8305AFF8C5338D8054373 /Users/username/Projects/MyApp/MyApp.Mac/bin/Release/MyApp.app//Contents/Frameworks/ThemeKit.framework/ThemeKit
Tool /usr/bin/codesign execution finished (exit code = 0).
/Users/username/Projects/MyApp/MyApp.Mac/bin/Release/MyApp.app//Contents/Frameworks/ThemeKit.framework/ThemeKit: replacing existing signature
/Users/username/Projects/MyApp/MyApp.Mac/bin/Release/MyApp.app//Contents/Frameworks/ThemeKit.framework/ThemeKit: signed bundle with Mach-O thin (x86_64) [com.luckymarmot.ThemeKit]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Shared.targets(975,3): error MSB4018: The "Codesign" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Shared.targets(975,3): error MSB4018: System.AggregateException: One or more errors occurred. (Could not find a part of the path '/Users/username/Projects/MyApp/MyApp.Mac/bin/Release/MyApp.app/Contents/Frameworks/ThemeKit.framework/_CodeSignature'.) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/username/Projects/MyApp/MyApp.Mac/bin/Release/MyApp.app/Contents/Frameworks/ThemeKit.framework/_CodeSignature'.

The linked framework in question, does have a _CodeSignature folder, however it is in a different location to that looked for by the msbuild task.

101384-image.png

I have been using the same project structure to build for at least six months and there was no problem when I built a release on 19th March 2021. I have reverted my code to the version used for the last successful build, and this now also fails. I always keep my tooling up to date, so I suspect something has changed in how the build works?

Any advice on how to diagnose and fix this issue would be greatly appreciated as it is currently preventing me from creating new releases of my application.

If there's anything important that I've left out, let me know.

Thanks.

(Please note, I appreciate this is not a dotnet-xamarinforms question, but I was unable to find tags that were appropriate and I am unable to create new tags.)

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,378 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.