none
Build failed due to validation errors RRS feed

  • Question

  •  

    Hi,

    it's not a new problem, but can't find any solution on web, the ones i've found were targeted to Visual Studio 2008 beta 2 or smth, i have Visual Studio 2008 TS SP1 beta1.

    So the problem is, that i can't build web setup project, it spits this error:

     

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

     

    I've looked at the dbml encoding as suggested some posts for VS2008 beta2, encoding is right, i've removed dots from connection string as suggested someone - didn't helped. When i open dbml with xml editor it can't find any errors, the main project builds and runs fine, so i can't find any clue, why it could contain any errors.

    Thursday, June 5, 2008 6:17 AM

Answers

  • I might have found a solution.

     

    I went to the folder located at C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. I did a command line startup of visual studio there using this command:

     

    devenv /log c:\ActivityLog.xsl

     

    Then I tried to rebuild my project. My ActivityLog.xsl had no errors, but a few warnings. I did a search in the file for the string "warning" and I eventually found this GUID:

     

    8D8529D3-625D-4496-8354-3DAD630ECC1B

     

    Then I googled it, which lead to this forum thread:

     

    http://forums.msdn.microsoft.com/en-US/vssetup/thread/2ed4a7c2-7def-42b1-a52c-85476d493af1/

     

    Using that thread, I did another command line command:

     

    devenv /resetskippkgs

     

    I then reopened my solution and was able to build my project, open DBML files and insert new DBML files with the ability to edit them in visual mode.

    Thursday, June 12, 2008 8:49 PM

All replies

  • Hello,

     

    I tried to reproduce the behavior you have reported, but could not do so.

     

    Can you please share any details around the validation errors you see? Would it be possible for you to post a small project/solution that exhibits the problem? If not, can you list the steps you followed in creating the project?

     

    Thanks,

     

    --Samir

     

     

    Thursday, June 5, 2008 4:24 PM
  • it might be sth to do with sp1 beta version, have you tried to reinstall vs.net 2008 without the sp1?

    Thursday, June 5, 2008 8:07 PM
  • Are there any other errors or warnings in the error list?

     

    [)amien

     

    Monday, June 9, 2008 11:03 PM
    Moderator
  •  

    I'm getting the same errors too.  Never had any problems before but today I tried to build my project and I'm geting the same errors.  It says to open the file and resolve the issues in the Error List but the only errors I see are the ones saying to open the file and resolve the issues in the Error List!
    Tuesday, June 10, 2008 8:57 PM
  • Have you done anything to your project or installation since you last compiled?  E.g. added a new table to the designer or installed VS2008 SP1 beta?

     

    [)amien

    Tuesday, June 10, 2008 10:27 PM
    Moderator
  • I've got the same problem. It only started recently and it seems to coincide with release builds. The only difference between a release build & a debug build for the affected solution is a Dotfuscator project, but the build fails well before it gets there. I've noticed that I can get it to build by switching it back to debug, doing a build and switching back, closing & re-opening the solution, and / or closing & re-opening visual studio, or some combination of these. I've also learned to avoid re-builds at all costs as this will surely trigger this result. Only builds seem to get by.

     

    There are about half a dozen data contexts spread over as many projects in this solution and none of them have changed between when it works and when it doesn't. I also don't have sp1 beta installed.

    Wednesday, June 11, 2008 4:57 AM
  • When this happens if you open the DBML file do you see any syntax errors or invalid XML?

     

    [)amien

     

    Wednesday, June 11, 2008 4:46 PM
    Moderator
  • None. I've also seen in other posts that there were problems with the encoding in some of the beta versions, but all of these are utf-8.

     

    I was also wondering if the connection would have anything to do with this. If I create the context on one computer & then add a table on a second computer, I always get a message that the connection used to access the table is different than the one stored in the data context & would I like to update. If I don't, it won't add the table, but I consistantly try to turn these off so that it will force me to pass a connection string to the constructor. Each time I modify it though, it seems to forget this. Where I think this may be involved would be the following: Create a context on one computer with it's connection string and then build it on another computer. If adding a new table on that computer would cause problems because it thinks the connection string is different, would it somehow fail to validate the dbml for this reason also?

     

    Wednesday, June 11, 2008 5:14 PM
  • I'm getting the same error:

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

    Automatic updates did something without my approval the other day and I eventually rebooted my comp this morning. Now my project won't build. When I try to open the DBML file, I get this error:

    Cannot load 'C:\...file.dbml':Error encountered, check Error List window for details.

    and here's the error list window:

    Error 1  Could not retrieve the current project.
    Error 2  Could not retrieve the current project.
    Error 3  Ambiguous moniker '/' encountered. It is used for both '' and ''.
    Error 4  Build failed due to validation errors in C:\...\file.dbml. Open the file and resolve the issues in the Error List, then try rebuilding the project.

    I haven't made any changes to the web.config file or the DBML file. I checked another site that said to remove perioids from the connection string in the web.config file, but I don't have any periods in the connection string.

    Does anyone have a solution to this problem yet?

    Thursday, June 12, 2008 4:13 PM
  • While you are getting this error in your project could you try creating a second LINQ to SQL Classes file and putting a single table from the same database on the surface, saving and compiling.

    That should point toward whether the problem is with the existing DBML/CS file or the overall project/environment.

    Thanks,

    [)amien
    Thursday, June 12, 2008 7:43 PM
    Moderator
  • I inserted a new DBML file into the project. After I did this, I clicked on it to open it so I could insert a table from SQL Server explorer, but I got a popup window saying, "The operation could not be completed". I also still cannot build the project.

    Thursday, June 12, 2008 8:09 PM
  • I did this & only the original dbml had validation errors. The new one worked fine. Then I added a table to the original dbml & it built fine. Then I deleted the table & it still built.

     

    Thursday, June 12, 2008 8:43 PM
  • I might have found a solution.

     

    I went to the folder located at C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. I did a command line startup of visual studio there using this command:

     

    devenv /log c:\ActivityLog.xsl

     

    Then I tried to rebuild my project. My ActivityLog.xsl had no errors, but a few warnings. I did a search in the file for the string "warning" and I eventually found this GUID:

     

    8D8529D3-625D-4496-8354-3DAD630ECC1B

     

    Then I googled it, which lead to this forum thread:

     

    http://forums.msdn.microsoft.com/en-US/vssetup/thread/2ed4a7c2-7def-42b1-a52c-85476d493af1/

     

    Using that thread, I did another command line command:

     

    devenv /resetskippkgs

     

    I then reopened my solution and was able to build my project, open DBML files and insert new DBML files with the ability to edit them in visual mode.

    Thursday, June 12, 2008 8:49 PM
  • This worked for me. Good find.

     

     

    -- Update 6/15 --

     

    This worked for a few days, but now it's doing it again.

     

    Friday, June 13, 2008 3:51 AM
  • Have you tried running the command again?

     

    If you do and that fixes it then it would seem something is causing the package to stop loading and we should investigate what could be causing that to happen.

     

    [)amien

     

    Thursday, June 19, 2008 9:39 PM
    Moderator
  • Yeah, running it again fixes it until I do a rebuild. As long as I keep to builds I'm ok.

     

    Thursday, June 19, 2008 10:12 PM
  • Interestingly enough, I've been getting the same errors randomly after I shut down VS2008. I can't determine any pattern, but the command line solution works every time. Another process I tried to get rid of any errors caused by my Linq to SQL files (DBML) was this:


    1) Make a backup copy of the DBML files.

    2) Close VS2008.

    3) Clear VS2008's cache located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

    4) Reopen VS2008.

    5) Add the DBML files back in via VS2008 (Right-click the project Add->New->Linq to SQL file).

    6) Open the backup DBML files and paste their code into the newly created DBML files.


    I did this because VS2008 would add duplicate DBML files by appending a '1' to the end of the DBML file in use. Any changes to my DBML files would almost always create these weird clone files. My experience with DBML files is this:


    If you have to make any changes to the DBML files and you get clones or the project won't build, do the above procedure so that VS2008 has a new copy of the DBML files and doesn't have any issues with caching.


    I think this might be a bug or multiple bugs the VS team should look into.

    Thursday, June 19, 2008 10:15 PM
  • I had the same problem, in my case it was caused by removing the connectionstrings from my project settings (as I supply those programmatically to the dbml file anyway).

     

    I solved the build problem by opening the dbml file and putting the connectionstring property to "Nothing".

     

    I hope this helps for you guys as well.

    Tuesday, June 24, 2008 9:07 AM
  •  I forgot about that part - I also set the connection to nothing. I also deleted the app.config and the Setting.setting that were auto-generated. Don't know why I needed to delete them, but that's what I was told to do.

    Tuesday, June 24, 2008 2:26 PM
  • I was getting the same error with no other errors in the Error List.

     

    I deleted the designer file, right-mouse clicked the .dbml and selected Run Custom Tool.  A new designer file was generated.

     

    Then I built the project again and this time I saw another error in the list: The DeleteOnNull attribute of the Association element '...' [snip].  Fixing this error allowed me to build the project again.

     

    I suspect that the original Build failed error may show up without any other errors in the list for more than just the DeleteOnNull issue, but so far this is the only one that has caused a problem for me.  (Previously there was more than one DeleteOnNull error - I fixed them all but apparently missed one.  Subsequent builds then failed to show that particular error in the list for the DeleteOnNull that I had missed.  I wonder now if restarting VS would have also helped in my situation.)

     

    - Dave
    Friday, June 27, 2008 5:47 PM
  • Worked for me too. svaed my bacon big time thank you Smile
    Tuesday, July 29, 2008 8:34 AM
  • I get this behavior, too, somewhat randomly. /resetskippkgs sometimes helps. I've also seen it in situations where VS wants to check out the solution every time that it opens. Undoing the check out in source code explorer fixed the error that time, but I have no idea why.

     

    Friday, September 19, 2008 3:10 PM
  • I'm having the same Issue...
    Feels stupid to have to close the solution and reopen it and all that to get rid of that error.
    Any permanent fix for that?
    Friday, January 9, 2009 6:06 PM
  • This is what I did. I put in the following prebuild event to sync the latest db tables with my dbml file. You can access the build event from the solution properties.
    "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SqlMetal.exe" /server:".\SQLEXPRESS" /database:demo /dbml:"E:\Temp\TestDBML\TestData.dbml". Make sure you are pointing to the correct sqlmetal path.

    Then, I run a build. If I don't delete the dbml.layout file in my case it's TestData.dbml.layout before I double click on my dbml file, it will complain that it cannot resolve the moniker. So I simply delete the layout file before I double click on my dbml and it will get rid of the problem. And I got the latest db changes in my dbml.

    I hope this helps. I am a newbie to linq stuff as well.

    Monday, April 20, 2009 4:56 AM
  • I have found solution for this problmem.

    I was surprised when I got no error after
    * backup DBML file with sattelites
    * removing DBML file from project
    * create new file with the same name
    * compile and fail
    * copy from backup and replace content

    The files really have no differents. But it worked!

    So I guess this is some mistake in the way how VS2008 compiles and I would like someone from Microsoft to fix this problem.
    If you get error like this try to find out what's wrong with your DBML. To do that just right-click on your DBML file and use item run custom tool.
    Then you will get more descriptive error message like

    Error 1 DBML1005: Mapping between DbType 'Date NOT NULL' and Type 'System.DateTime' in Column 'DateAdded' of Type 'LogInfo' is not supported.

    This is something you can work with. Go ahead and fix any mistake retrieved by Custom Tool Run


    atriplex
    Monday, September 28, 2009 8:41 AM
  • Setting the Connection string to "None" worked for me. Thought Id pass it on.
    Tuesday, February 2, 2010 2:53 PM
  • I opened my .dbml file with the xml editor and changed the second line, <Connection Mode="AppSettings"...> to <Connection Mode="ConnectionString"...>, then I rebuild successfully.  In reality the "ConnectionString" mode probably doesn't have any real effect on the problem, but maybe it causes the file to be recompiled, which is what it really needs anyway (hence some of the other suggestions about backing up the file, deleting and replacing... but this is a quicker solution then deleting and replacing files, etc.)

    This is after I had tried opening visual studio from the command prompt with "devenv /resetskippkgs" -- which wasn't working for me.

    I've only noticed the problem in solutions that mix c# and vb projects.  And I only notice it in the c# projects when my .dbml file is defined in a vb project.  Don't know if this observation accords with other problem'ees.  

    Thursday, May 20, 2010 6:19 PM
  • I'm not sure but I think this problem revolves around credentials of different users who have created and/or updated the dbml file last. This usually (but not always) happens when another developer has modified the dbml and then I get the latest version of the dbml from the repository. If I modify the dbml in some way (remove and re-add a table for instance), the designer warns me that the user is different from the last user that saved the dbml file. If I accept the changes and modify the dbml, then I can build.

    Anyone else noticed this behavoir?

    Monday, June 21, 2010 6:57 PM
  • @gregdosborne

     

    I have not noticed that.  In my case I am the only developer working on the .dbml file and I only ever do it from one computer and I only ever log in as one user.  But that leaves open the possibility that it happens in your case also -- but it happens in my case for different reasons.  And actually, I haven't noticed the problem for weeks now.  I would say that in my case what I did fixed the problem -- namely, changing the Connection Mode from AppSettings to ConnectionString.  Perhaps this has some effect between C# and VB due to differences in the way that "AppSettings" are resolved?  

     

    I don't know.  

    Thursday, June 24, 2010 1:26 PM
  • I had to reopen them and set the connection string to (local), save it and then recompiled and it worked. I did not have to close or restart VS2008 or anything else.  The person in my team who had created the dbml file, had pointed it to one of our development server. But in my instance of VS, there was no connection to this server.  Perhaps this is why the word "validation" is used in the error message since it is trying to see if the connection string is valid.

    Tuesday, July 13, 2010 5:49 PM
  • It is really a great fix. Thanks alot it worked fine for me. i am able to open all dbml files, and the error not apearing any more.

    Great!

     

    Thanks

    --Suresh

     

    Friday, August 6, 2010 11:49 PM
  • I had also the same problem, but the following procedure let VS always compile the code correctly:

    Close VS

    delete all files in the obj\x86 (and eventually x64)\Debug (and Release)\ directory

    Then start VS again via command line using

    <Path>\devenv.exe /ResetSkipPkgs (optionally: <Name>.sln to open directly the correct project)

    (Not sure whether the /ResetSkipPkgs is necessary, but another info below told so. I made a small batch script which does all of this automatically). The code should compile now without any problems!

    For reference, my script file looks like this:

    del /Q C:\[...]\[...]\obj\x86\Debug\*.*
    
    "C:\Programme (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /ResetSkipPkgs C:\[...]\[...]\<Name>.sln

    (I always develop in debug mode, thus I only delete the matching x86\Debug directory...)


    • Edited by Celebrandt Wednesday, August 21, 2013 7:54 AM
    Wednesday, August 21, 2013 7:54 AM