How to force monodevelop to use my code policy on new projects

I have found a few things around the internet about doing this, but none of them are permanent. I can get mono to use my policy, but the next time I switch to Unity and back it is using the default policy again.

I’m a bit of a neat freak when it comes to how my code looks and am getting really frustrated with having to write a block of code and then go back and put it how I typed it in the first place.

Any help appreciated.

From my experience and i’m similar that i present my code layout in a particular way, a new solution in monodevelop gets all the defaults, creating a custom policy that i save, allowing me to apply it to new solutions when created is the trick.

From StackOverflow:

  1. MonoDevelop->Custom Policies->Add
    Policy->New Policy

  2. Edit the policy inside of the
    ‘Custom Policies’ window, making
    sure your policy is selected.

  3. Project->Apply Policy->Apply Stock
    or Custom Policy Set (select your
    policy)->Apply

but you want to apply it to your solution:

  1. (right click the solution, then Tools->Apply Policy) and save the solution under a new filename. That way, Unity won’t overwrite your settings every time it regenerates the projects.

I think I found a better solution than forking the sln project.

Find where MonoDevelop store the policies.

In the case of Mac is: ~/Library/Preferences/MonoDevelop-Unity-5.0.

You will find there a Default.mdpolicy.xml and your own mdpolicy file ( WhateverYouNamedIt.mdpolicy.xml ).

Just overwrite the default with yours and suddenly it all goes to your policy as the default.
I’ve tried a couple times and seems to be working fine.