Could not open key Software\Microsoft\ASP.Net\4.0.30319.0. Verify that you have sufficient access to that key, or contact your support personnel.

This problem can occur when installing a web project that has been built using VS2010. The full error text is:

Could not open key Software\Microsoft\ASP.Net\4.0.30319.0. Verify that you have sufficient access to that key, or contact your support personnel

There is a new property within VS2010 web setup projects called ‘ASPNETVersion’¬† which defaults to “4.0.30319.0”. This obviously causes an issue if the web project is being deployed on a server that only has ASP.Net 2 installed.

Luckily the fix is easy:

  • Open the setup project
  • Change the “ASPNETVersion” property from¬†“4.0.30319.0” to “2.0.50727.0”
  • Rebuild the setup project
  • Reinstall on the target server