- Home /
Question by
eventropy · Jan 07, 2016 at 05:01 AM ·
unity5monodevelopvisual studiosolution
Is there a way to get Unity to generate the MonoDevelop/VS solution WITHOUT actually opening it?
In other words, I'm in a situation where I need to get unity to update the MonoDevelop / Visual Studio solution file, while within an editor script in Unity, BUT without opening the solution.
I've found I can execute this:
EditorApplication.ExecuteMenuItem("Assets/Open C# Project")
And this works exactly how I was hoping when Unity is in batch mode (does not open it, and only generates it) but I can't for the life of me figure out how to do this same thing in editor.
Comment
Best Answer
Answer by eventropy · Jan 07, 2016 at 05:15 AM
Figured it out. Not officially supported, and no guarantee it will keep working, but good enough for my purposes :)
public static void SyncVsSolution()
{
System.Type T = System.Type.GetType("UnityEditor.SyncVS,UnityEditor");
System.Reflection.MethodInfo SyncSolution = T.GetMethod("SyncSolution", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
SyncSolution.Invoke(null, null);
}