I recently cleaned out my laptop and realised that I did not backup my Visual Studio settings or any of the other tweaks or enhancements that I’ve made over the years. Most infuriatingly my Intellisense for NHibernate mapping files disappeared, so to put them back in place:

If you haven’t got the latest version of NHibernate, you can get hold of v2.0.1GA here. Be sure to get the source archive because this contains the schema files  which can be found in the src/NHibernate folder.

Find the 3 files:

  1. nhibernate-configuration.xsd
  2. nhibernate-generic.xsd
  3. nhibernate-mapping.xsd

Copy them to Program Files (x86)\Microsoft Visual Studio 9.0\Xml\Schemas – there should be a lot of existing xsd files in there already.
Note: if you run a 64bit Windows OS, you’ll find that %ProgramFiles% will point to the wrong folder… Visual Studio remains 32bit.

Now the important bit….

Rename the above 3 files by adding the suffix “-2.2” – I guess that the standard build never renamed the files from 1.2, but Visual Studio / Intellisense needs this to map the namespaces. Thus:

  1. nhibernate-configuration-2.2.xsd
  2. nhibernate-generic-2.2.xsd
  3. nhibernate-mapping-2.2.xsd

If you haven’t got Visual Studio open already, then open it up and play…. otherwise you might just have to close and reopen the mapping files.