views:

552

answers:

4

I had been happily coding along on a decent sized solution (just over 13k LOC, 5 projects) which utilizes Linq to Sql for it's data access. All of sudden I performed a normal build and I received a sweet, sweet ambiguous message:

Error 1 Build failed due to validation errors in C:\xxx\xxx.dbml. Open the file and resolve the issues in the Error List, then try rebuilding the project. C:\xxx\xxx.dbml

I had not touched my data access layer for weeks and no adjustments had been made to the DBML file. I tried plenty of foolhardy tricks like re-creating the layout file, making copies and re-adding the existing files back to the project after restarting Visual Studio (in case of some file-level corruption); all to no avail.

I forgot to wear my Visual Studio Skills +5 talismans, so I began searching around and the only answer that I found which made sense was to reset my packages because Visual Studio was not loading an assembly correctly. After running "devenv.exe /resetskippkgs" I was, in fact, able to add the dbml file back to the DAL project and rebuild the solution.

I’m glad it’s fixed, but I would rather also gain a deeper understand from this experience. Does anyone know how or why this happens in Visual Studio 2008?

New Edit: 10/30/2008 THIS WAS NOT SOMETHING THAT JUST HAPPENED TO ME. Rich Strahl recently wrote on his "web log" about the same experience. He links to another blog with the same issue and used the same action.

I have encountered this issue a few times since this original post as well, making me think that this is not some random issue. If anyone finds the definitive answer please post.

A: 

TBH, I have had a couple of instances like this where files "seemed to go crazy".. However, upon investigation it has appeared that the files have changed in some way, shape or form.. (e.g. sometimes changes can be made to the file by inadvertantly changing a property somewhere that seems unrelated).

I think there are too many possible issues that could really cause this, and based on the fact that the problem has been resovled, it seems like an answer will not be found..

Rob Cooper
A: 

@Rob Cooper, thank you for the reply. A very valid point except a quick Google using various parts of the error message tossed are all people encountering what I hit and are all using LinqToSQL. That tends to make me think its more than a weird isolated issue. Furthermore, if its something that really wrong with VS it might not appear on MSDN (though Microsoft doesn't tend to remove threads the way Apple seems to).

If it fails to receive an answer in a short amount of time, I'll close it out.

Ian Patrick Hughes
+1  A: 

After installing Phalanger for Visual Studio 2008, I attempted to create a new PHP WinForms Application. The project creation failed with a similar error message, stating that a DLL required could not be loaded (Failed to load file or assembly...). Running the devenv.exe /resetskippkgs command in Visual Studio 2008 Command Promtp resolved the issue immediately.

Thanks for the info.

Yep. I am seeing that all over the web lately. The issue is I have not heard a concrete reason of "why" or "how" this actually happens with a .dbml file. Probably because Microsoft is not going to support LinqToSql as we know it in the future.
Ian Patrick Hughes
+1  A: 

I also get this error when trying to compile the data access layer in the second solution (installer). What I do is that I run Custom Tool on the dbml-file, and this does it.

There is really no errors in the dbml file that needs to be corrected.

My theory in this is that Visual Studio caches the compiled version of the dbml file, and that the cache is invalid for other solutions. I guess running /resetskippkgs does the same thing as recompiling the dbml file.

Anyway, there are no fix for this yet?

JERKER
I have not had it happen in VS 2010 yet, so maybe its fixed and backwards support is just not going to happen.
Ian Patrick Hughes
Well, I should have said that I still work in VS 2008...
JERKER