I'm using Visual Studio Database Project (DBPro) since beta versions. It's a great product but with several issues that had being fixed during the time. The last version in VS 2008 SP1, has a lot of improvements. I would like to mention the support to synchronize the database against the project, which does not work very well in previous versions.
Last week I've experiencing 2 new errors, when opening a Visual Studio solution with a database project in there.
Error 1: "Instance not set to an instance of an object"
This happens when the solution try to load the DBPro and it fails. The project remains in an unloaded state.
You can't even create new DBPro projects. I've tried to create a new project, but at the end of the wizard Visual Studio returns me the same error message.
My good friend Rui Inácio, told me that he had fixed, the exactly same error, creating a new user profile in his machine. After login with the new account he was able to create and open DBPro projects.
I thought this was not a good solution, because i need to recreate all my old profile (mail accounts, desktop preferences, etc ...), so i've decided to keep searching on a better solution. After a quick googling i was not able to found a solution to fix this error. So i've decided to dive in the DBPro options, and try to understand what should cause this.
After changing a few settings i've remember that, for a specific project, i've changed the setting "Maximum errors and warnings to display" to 0. The default is 200.
You can find this setting in the following location: Tools -> Options -> Database Tools -> Design-time Validation Database.
I've changed this setting back to 200, and press and VOILA !!!, it fixes the error. I'm now able to create an open DBPro projects again.
Error 2: "Failed to attach database"
Following the error 1, Visual Studio presented me with the error message "Failed to attach database".
This was easier to fix. Just delete the .user database project file and open the project in Visual Studio again. The .user file will be recreated and you will be able to open DBProj projects again.