[remove] Force strip AOT assembly resources.

pull/54/head
moogle 2025-04-02 17:57:40 +08:00
parent 603b0ccb24
commit 916b418586
1 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,14 @@ namespace HybridCLR.Editor.AOT
{
public static byte[] Strip(byte[] assemblyBytes)
{
var mod = ModuleDefMD.Load(assemblyBytes);
var context = ModuleDef.CreateModuleContext();
var readerOption = new ModuleCreationOptions(context)
{
Runtime = CLRRuntimeReaderKind.Mono
};
var mod = ModuleDefMD.Load(assemblyBytes, readerOption);
// remove all resources
mod.Resources.Clear();
foreach (var type in mod.GetTypes())
{
if (type.HasGenericParameters)