I've had a similar problem with my A6. In order for an engine to work it needs to have the matching ECU, injection pump. If it's not the same engine code it'll need to be coded to the current injection pump. As the injection pump, ECU and instrument cluster are all linked with the imobiliser. Or that's at least the case with my older A6.
If you find someone who can do the engine swap and it's not the same engine code then please let me know