Replicated code from https://github.com/Fody/Fody/issues/363
Replicated code from https://github.com/Fody/Fody/issues/363

Fixes #272

GeertvanHorrik/Costura,GeertvanHorrik/Costura,Fody/Costura,Fody/Costura