maui icon indicating copy to clipboard operation
maui copied to clipboard

Unable to build in Release

Open Woetroer opened this issue 1 year ago • 12 comments

Description

When I try to build my application in Release mode I get the errors "Optimizing assemblies for size failed" and "Failed to write" see this screenshot.

I have tried setting publish trimmed to false as suggested by the error without success.

Steps to Reproduce

  1. Open the project from the referenced reproduction repository.
  2. Build in release

Link to public reproduction project repository

https://github.com/Woetroer/ToDo/tree/master

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 12

Did you find any workaround?

No response

Relevant log output

No response

Woetroer avatar Mar 03 '23 11:03 Woetroer

Hi, @Woetroer - would you be able to share the full error logs? I unfortunately am not seeing the screenshot you mention. Thanks!

rachelkang avatar Mar 06 '23 15:03 rachelkang

Hi @Woetroer. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Mar 06 '23 15:03 ghost

Hi, @Woetroer - would you be able to share the full error logs? I unfortunately am not seeing the screenshot you mention. Thanks!

Hi Rachel, I have attached the screenshot.

Woetroer avatar Mar 07 '23 11:03 Woetroer

@jonathanpeppers thoughts?

In the meantime @Woetroer can you attach a binlog? https://github.com/xamarin/xamarin-macios/wiki/Diagnosis

PureWeen avatar Mar 07 '23 19:03 PureWeen

Hi @Woetroer. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Mar 07 '23 19:03 ghost

Yes, a .binlog would show the actual underlying error from ILLink. I don't think we have enough information on a screenshot.

jonathanpeppers avatar Mar 07 '23 20:03 jonathanpeppers

@PureWeen @jonathanpeppers I have now attached the zip file with the binlog to the repository

Woetroer avatar Mar 08 '23 15:03 Woetroer

Is it the correct log? It has no errors inside:

image

You can open these files with the tool at https://msbuildlog.com to view them.

jonathanpeppers avatar Mar 08 '23 15:03 jonathanpeppers

Hi @Woetroer. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Mar 08 '23 15:03 ghost

@jonathanpeppers Yes I used the tool to build the project and generate the log file. After that I zipped it and sent it here.

This is what I see 2023-03-09 09_42_35-C__Users_Woetroe_source_ItvitaeRepos_ToDoApp_msbuild binlog - MSBuild Structured

Woetroer avatar Mar 09 '23 08:03 Woetroer

@Woetroer in your log the build succeeded. If it was a failure, the log view automatically searches $error (with a dollar sign) and shows the error message. There are no errors in here?

Do you need to try again and do a Release build? -c Release

jonathanpeppers avatar Mar 09 '23 23:03 jonathanpeppers

Hi @Woetroer. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Mar 09 '23 23:03 ghost

@jonathanpeppers I tried Command line arguments = "C:\Program Files\dotnet\sdk\7.0.201\MSBuild.dll C:\Users\Woetroe\source\ItvitaeRepos\ToDoApp\ToDoApp.sln /property:Configuration=Release /v:diag /nologo /clp:NoSummary;Verbosity=minimal /bl" this as the cli argument. The build succeeded and gave no $errors again.

Woetroer avatar Mar 13 '23 13:03 Woetroer

We need a .binlog with the details about "Optimizing assemblies for size failed" inside.

Did the problem mysteriously go away?

jonathanpeppers avatar Mar 13 '23 15:03 jonathanpeppers

We need a .binlog with the details about "Optimizing assemblies for size failed" inside.

Did the problem mysteriously go away?

No it still gives me the errors when I build in visual studio. I can't seem to build it in release using the ms build log viewer.

Woetroer avatar Mar 13 '23 16:03 Woetroer

You don't actually have to build it with the .binlog viewer, but you can just add -bl to any dotnet build or msbuild command.

If you want to try inside VS you can use:

https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProjectSystemTools2022

Just make sure you have this enabled:

image

View > Other Windows > Build Logging can record .binlog files.

Find one that contains your error. Thanks!

jonathanpeppers avatar Mar 14 '23 01:03 jonathanpeppers

Hi @Woetroer. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Mar 14 '23 01:03 ghost

@jonathanpeppers After installing project tools and setting the setting to diagnostic I ran the build in release. It finished with no errors. I think the errors somehow went away. If the errors return I will provide the build log but it works for now. Thanks.

Woetroer avatar Mar 14 '23 07:03 Woetroer

Let us know and we can reopen, thanks!

jonathanpeppers avatar Mar 14 '23 13:03 jonathanpeppers