toptensoftware/nvpatch

nvpatch overwrites files that are included in a .NET publish when `PublishSingleFile` is enabled

Closed this issue · 3 comments

Hey Brad!

Thank you for publishing this tool and documenting the approach. Pleasure reading through and following the code.
I've encountered a problem where nvpatch breaks files that .NET includes in a PublishSingleFile-enabled publish.

The cause seems rooted in .NET's approach to bundling those files - they're appended directly to the end of the PE executable, which nvpatch also uses as the location to write the new export table.

I'm currently investigating a fix for the issue, my hope is that shifting the content after the executable down to make room will not break the .NET PublishSingleFile option.

Interesting. Thanks for the info. I had heard of issues with .NET but nobody had mentioned this was specific to bundled single file publishing. Let me know how you get on with this - happy to accept a pull request to fix it if you figure it out.

Alright, I got it! Check the pull request for more context. That was genuinely quite fun, hope the fix is up to snuff!

Cheers 👍

Thanks for that. I'm not actively working on this project at the moment so I'll take your word for it that it works and have merged it, built it and published it as b104. Thanks again.