Sunday, 18 October 2009

Unity configuration intellisense

I’m late to the whole IOC party and since in work we use the Enterprise Library as our standard for majority of functionality we may want (like logging, error handling, etc) so Unity is the first stop I’ll make for an IOC.

Now the first thing I expected was to have intellisense to help me with the configuration so you can imagine my surprise when after I referenced the assembly the Enterprise Library configuration tool didn’t offer me ability to configure unity and when I dropped into the web.config to add the config manually there was no intellisense.

So I opened google and had a look around and found Unity Community Contributions which contains a set of extensions to unity one of which is an xsd that provides intellisense (its easiest to get it here as you can down load it by itself outside of the main project).  There is one draw back - you have to configure each project that you want to use it with, you can’t set it up so that its used by default each time.

Once you’ve downloaded it you need to Place the xsd in <drive>:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas.

To be able to use it you need to configure the properties of the config file that you will be putting the unity config in.  To do this open the config file and then go to the properties pane where you will find a property called schemas.

At the end of the schemas property you find the standard … button to open a dialog.

You should find the unity xsd listed and all you have to do is to select use and click ok and then you’ll have intellisense.

No comments:

Post a Comment