Jon's Blog

.NET Development & More

Visual Studio: Build failed due to validation errors in dbml file

Today, while attempting to build a class library on our build box I received the following error in Visual Studio 2008:

"Build failed due to validation errors in [FileName].dbml.  Open the file and resolve the issues in the Error List, then try rebuilding the project."

However, when I went to the dbml file no errors were shown in the error list.  To resolve this I deleted the .designer.cs file associated with the dbml file.  Then in Solution Explorer I right-clicked on the dbml file and selected "Run Custom Tool."  This regenerated the .cs file and I was then able to see the error, which was the following:

"DBML1005: Mapping between DbType 'Date' and Type 'System.DateTime' in Column '[ColumnName]' of Type '[TypeName]' is not supported."

This was easy enough to fix.  The Server Data Type just needed to be changed to DateTime.  Strangely enough having just Date on my development machine did not break the build.

I believed the root of the problem may be that the version of Visual Studio on my development machine was 9.0.30729.1 SP and the build machine was 9.0.21022.8 RTM.

Comments (2) -

  • Mr M

    8/4/2009 4:03:53 PM |

    Thanks man! I've been fighting against that all day long.

  • Blue

    6/25/2010 3:40:45 PM |

    Thank you so much, this was exactly what was needed.   I couldn't understand why I could (A.) Build the application and its library outside of the installer project, (B.) Build the library containing the DBML file manually inside of the installer project, but could NOT build the application and its library inside of the installer project, until I performed these steps.

    You have saved me many headaches, I feared having to recreate the whole DBML!

Comments are closed