Niall McGinn's 17th goal of the season was enough to guide Aberdeen to a 1-0 victory over SPL basement boys Dundee.