If the rifle can safely function, I'd field strip it as much as you can(or what the firearm owner's manual allows), then spray on a lot of Birchwood Casey Gun Cleaner(or a related brand from a major firm).
Let the rifle sit and then remove all the gunk/caked on oil/dirt/dust/etc.
This may take some time & effort depending on the amount of crud on the rifle parts. A decent well made synthetic CLP like Eezox, Weaponshield, Mpro7's LPX or Gunzilla can assist you.
If the crud/dirt/oil are deep inside the firearm or you can't access all the moving parts, you may want to take it to a trained, qualified gunsmith.
If you haven't shot or checked the rifle it may not be safe to operate.
In the future, a small amount of CLP or oil is all you'd need to use on the rifle.
See here;
www.Eezox.com www.Weaponshield.com www.Mpro7.com www.Brownells.com .
CF