AssemblyPublicizer also adds AllowUnsafeBlocks
to the project, according to this comment.
So maybe try add something like this to your project:
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>