-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to codesign a MacOS app corrupts the app #24337
Comments
I think the SDK team might be able to help with this publish related question. Transferring to that repo. |
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Is there anything I can do to help triage this? I've recreated the problem with the five minute sample application from the .NET documentation. |
Simple example of reproducing the bug:
I suspect that "replacing existing signature" is relevant, but I can't for the life of me find any documentation about how to prevent dotnet from signing automatically or how to tell it to sign with the correct certificate. |
@baronfel is there anything else I can do to help move this along? It's blocking a production release for me. |
I haven't dug in all the way, but based on #24181 it looks like you could have the dylibs included in the single-file version of the app by setting |
That doesn't seem to work:
|
Have you been able to try the same command without the symbols flag? |
Builds, but is still corrupted:
|
@ndw can you try the |
Right. I did this a couple of days ago, but I guess GitHub ate my comment because it was more than 64K. |
That's for the publish command itself, I think we'd need to see the same trace logs for actually running |
Sorry I misunderstood. Here you go. |
Ping? |
Next best thing is something I found in this issue - setting |
Also seeing this issue as well. Executable works fine until it is signed. Update: I found this article and it helped https://learn.microsoft.com/en-us/dotnet/core/install/macos-notarization-issues#default-entitlements. I was signing the dotnet executable with entitlements, but I was missing a few of the required ones. This was the plist that worked for me.
|
I'm returning to this task much later than I anticipated. I'd like to try the plist solution proposed, but I'm unclear on where this plist should be placed and what it should be called... I think I figured this out: it's passed to |
@ndw We keep an entitlements.plist in the project folder. I believe it can be placed anywhere. Heres a simplified version of the command we use that works
|
Thank you @devon94. I believe I finally wrestled the whole process to the ground. Breadcrumbs for the next traveler: https://dev.saxonica.com/blog/norm/2022/12/21-net6.html |
Description
I'm trying to publish a command line MacOS application built with .NET. I've read many of the issues related to this, but none seems to precisely cover my case (at least not in a way that I understand). I did gather that it doesn't work in .NET 5 so I've updated to .NET 6. In order to get it past gatekeeper, I need to sign, notarize, staple, bend, fold, spindle, etc.
I can't seem to get past the first step. If I use
codesign
to sign the app, the app is then corrupted and won't run.I'm slightly confused by the "replacing existing signature" message. I haven't configured .NET to do signing automatically, at least not on purpose, and if it is signing automatically, I don't see how it could be using the right key ID.
On a possibly related note, I'm surprised by the build artifacts that
dotnet publish
produces. I'm runningBut I'm not getting a "single file":
(If I don't use the single file option, I get dozens and dozens of files, so it's certainly closer to single file!)
On other occasions, with slightly different publish commands, I get more or less further along. Sometimes I can sign the SaxonCS file and it runs, but complains the other dylib files aren't signed. If I sign them, things crash differently.
I fully expect this is user error, but I cannot find any explanation of either what I should be doing or what I might be doing wrong.
Configuration
Other information
The text was updated successfully, but these errors were encountered: