Visual studio Intellisense is one of the best feature’s in Microsoft arsenal. So if at any point I don’t have it working for me I end up spending more time then I probably should be. This is specially true while configuring the config file for Unity. May be I’m jumping ahead. Lets step back to the most crucial question here
“Why should i use a config file at all for Unity ? ”
I generally tend to have behaviours and model split across assemblies. So there may be a situation where I havent referenced an assembly. But I know that by the time you get here it’ll be registered. So no harm done. But that just me.
Ok moving forward. How do I get an Intellisense in the config file for Unity configurations ? . The problem is Visual studio doesn’t have a schema defined for the Unity’s configuration section. A simple way would be to install the Enterprise Library by Microsoft. It come with a schema for Unity. To verify if you have a schema follow the mentioned steps
- Open a Visual studio solution
- Add a config file/ xml file.
- Open the file
- ONLY when you have such a file open will the Visual studio have the XML menu item.
- Open Schema in the XML menu
- See if you have a UnityConfiguration20.xsd
- If you do select it
Incase you don’t you search codeplex for the file and manually copy paste in to the following location.
\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas
But first i’d like to recommend extreme caution while doing anything on such sacred locations
Next verifying Intellisense support.Add a configuration file. Add a configuration section for Unity. Your code base should look something like this.
Once that’s done Intellisense should definitely be showing unity in its menu option. The Unity All In One has been updated.