Skip to content
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

MAUI project requires bin/obj folders removed for any MacOS build following a successful one #7353

Closed
alexeystrakh opened this issue May 20, 2022 · 2 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@alexeystrakh
Copy link

Description

MAUI project requires bin/obj folders removed for any build following a successful one

error : Failed to codesign 'xxx.app': xxx/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/xxx.app: replacing existing signature [xxx/xxx.csproj]

Steps to Reproduce

It's not reproduced on a new MAUI project but 100% reproducible on an existing project. Steps:

  1. Build a project once with dotnet build -t:Run -f net6.0-maccatalyst
  2. Build the project one more time with the same command

Result - the error Failed to codesign 'xxx.app'

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

MacOS 12.3.1

Did you find any workaround?

Remove bin/obj folders before each build

Relevant log output

No response

@alexeystrakh alexeystrakh added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 20, 2022
@VincentBu
Copy link

VincentBu commented May 20, 2022

I follow the repro steps described above and don't run into this error.(I'm using vs main build)

@VincentBu VincentBu added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 20, 2022
@jsuarezruiz jsuarezruiz added the area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging label May 20, 2022
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue May 20, 2022
The current directory at launch is the root directory of the app bundle. This
means that any files written to the current directory when an app is executed,
will be placed there. This becomes a problem when the app is rebuilt (and
resigned), because a valid macOS app bundle doesn't have any files in the root
directory of the app bundle, so signing fails.

We have logic to automatically crash crash reports from the app bundle, but it
turns out this is a more common problem with other types of files (and
folders), so improve the logic a bit:

* Add support for setting a property to automatically clean up everything from
  an app bundle we don't think should be there (which is anything not in a
  Contents/ subdirectory).
* Use the same property to add support for disabling any cleaning (we already
  clean mono's crash reports by default).
* Improve detection of unwanted files to include directories inside the app
  bundle, not only files.

Ref: dotnet/maui#7353
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue May 30, 2022
…15080)

The current directory at launch is the root directory of the app bundle. This
means that any files written to the current directory when an app is executed,
will be placed there. This becomes a problem when the app is rebuilt (and
resigned), because a valid macOS app bundle doesn't have any files in the root
directory of the app bundle, so signing fails.

We have logic to automatically crash crash reports from the app bundle, but it
turns out this is a more common problem with other types of files (and
folders), so improve the logic a bit:

* Add support for setting a property to automatically clean up everything from
  an app bundle we don't think should be there (which is anything not in a
  Contents/ subdirectory).
* Use the same property to add support for disabling any cleaning (we already
  clean mono's crash reports by default).
* Improve detection of unwanted files to include directories inside the app
  bundle, not only files.

Ref: dotnet/maui#7353
@alexeystrakh
Copy link
Author

In our particular case, the issue was related to custom build steps, that created extra files and preventing the app from being properly signed.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 2022
@samhouts samhouts added the platform/macOS 🍏 macOS / Mac Catalyst label Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/macOS 🍏 macOS / Mac Catalyst s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants