Fix XML encoding in LINQ to SQL files to open up in RTM designer window

When opening a dbml file created in a pre-RTM version of Visual Studio 2008, you will probably see this error message:

Cannot load ‘[filepath].dbml’: Error encountered, check Error List window for details.

Looking in the error list window, you might see the following errors:

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

and

There is no Unicode byte order mark. Cannot switch to Unicode.

Opening up the dbml file in the XML editor, the intellisense does not point out any validation errors.

 I couldn’t see the problem.

Then I created a new LINQ to SQL file and looked at the xml,noticing that the encoding was:

<?xml version=1.0 encoding=utf-8?>

while the old file had

<?xml version=1.0 encoding=utf-16?>

So I modified the old file changing the encoding to utf-8 and voila, my project compiled and the file opened up in the designer.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

One thought on “Fix XML encoding in LINQ to SQL files to open up in RTM designer window

  1. Julie:I just opened an old VS 2008 Beta 2 project and received the errors you wrote about.Your suggested fix solved my problems.Thanks for the info!…Bryan

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.