Skip to content

Conversation

@dvoituron
Copy link
Collaborator

[MessageBox] Fix the MessageBox usage in WASM projects

During the WASM DotNet Publication process, the unused classes are automatically removed from the final library. The Dialog razor file will be removed if no reference are set by your code. For example, if you call var = await DialogService.ShowDialogAsync<SimpleDialog>(simplePerson, parameters); the SimpleDialog will be removed by the WASM Publication process. You can configure this behavior by setting the PublishTrimmed property in your project file or you can create a temporary instance var temp1 = new SimpleDialog(); to force the Publication process to keep this class in the final library.

In this PR, this action has been taken for the MessageBox class, to solve #1057.

Another solution could be to use:

<!-- Don't trim these libs -->
<ItemGroup>
	<TrimmerRootAssembly Include="Microsoft.FluentUI.AspNetCore.Components" />
	<TrimmerRootAssembly Include="FluentUI.Demo.Shared" />
</ItemGroup>

Examples:

Before
image

After
image

@github-actions
Copy link

github-actions bot commented Dec 4, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1062.westeurope.3.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Dec 4, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1062.westeurope.3.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Dec 4, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1062.westeurope.3.azurestaticapps.net

@vnbaaij vnbaaij merged commit b03bbbf into dev Dec 5, 2023
@vnbaaij vnbaaij deleted the users/dvoituron/fix-messagebox-wasm-trimmed branch December 5, 2023 18:57
vnbaaij added a commit that referenced this pull request Dec 14, 2023
* Avoid to remove MessageBox in WASM projects #v3

* Fix comment

---------

Co-authored-by: Vincent Baaij <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants