Background: I am switching from WinForm to WinUi3 and we have the need to deliver the application as a usually windows executable. Therefore the idea was to deliver it as a standalone exe program.
I have selected self hosted in the project and also the single file option. after publish I get a large collection of files in the folder. The dll files can still be accepted, but many language folders are superfluous, especially the program is monolingual.
Is there a possibility to get it under control or are there other possibilities?
CodePudding user response:
You can remove unnecessary language folders, except your default language folder (en-us in this case), by adding these lines in your csproj file.
<Project...>
<Target Name="RemoveFoldersWithMuiFiles" AfterTargets="Build">
<ItemGroup>
<RemovingFiles Include="$(OutDir)*\*.mui" Exclude="$(OutDir)en-us\*.mui" />
<RemovingFolders Include="@(RemovingFiles->'%(RootDir)%(Directory)')" />
</ItemGroup>
<RemoveDir Directories="@(RemovingFolders)" />
</Target>
</Project>