Share via


Deserialization has failed for project...

The Visual Studio Team System 2008 Database Edition GDR introduced a new model based architecture that removes the product's dependency on a design db. In previous versions of the product a local instance of the SQL Server was required.  This local SQL Server instance would provide the design db for the project system and within this design db is where most of the validation was performed.  The GDR version provides a true model representation of the database schema and validation works on top of the model  and not in a physical database instance.  The model is stored in a SQL CE database while the project is open.  When the project is closed the model database is serialized to a file in the root of the project system called <ProjectName>.dbmdl. When the project is reopened the model is rehydrated from serialized copy.  This speeds up opening database projects, especially when the database schema in your project is large.
 
When you open your database project you will see in the output window when the model  is deserialized.  This will look like:

...

Deserializing the project state for project 'MYPROJECT.dbproj'...

Detecting file changes for project 'MYPROJECT.dbproj'...

Deserialization has been completed for project 'MYPROJECT.dbproj'.

...

Deserialization may fail if the project is not shut down properly, you don’t have enough disk space, or another program prevents the file from being serialized properly at the time the project was previously closed. If it does fail you may notice the following in your output window:

...

Deserializing the project state for project 'MYPROJECT.dbproj'...

Deserialization has failed for project ‘MYPROJECT.dbproj’. Project ‘MYPROJECT.dbproj’ will be reanalyzed.

Deserializing the project state for project 'MYPROJECT.dbproj'.

...

If this happens it can take some time for the project to be reanalyzed and for the model to be recreated for large projects. 

The first place to look to resolve the issue are indexing services and antivirus programs on your local computer. You want to prevent these programs from holding locks on the .dbmdl files when the model is being serialized to disk. I have found that excluding the directory where the project is stored from indexing services usually solves the issue.

Comments