Search the forum for "AddFromGuid" for examples of adding references via code.