Unity All in One : 2 of N : Adding Intellisense in the App.config


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

  1. Open a Visual studio solution
  2. Add a config file/ xml file.
  3. Open the file
  4. ONLY when you have such a file open will the Visual studio have the XML menu item.
  5. Open Schema in the XML menu
  6. See if you have a UnityConfiguration20.xsd
  7. 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.


      
  
  xmlns="http://schemas.microsoft.com/practices/2010/unity">

Once that’s done Intellisense should definitely be showing unity in its menu option. The Unity All In One has been updated.

Advertisements

One thought on “Unity All in One : 2 of N : Adding Intellisense in the App.config

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s