Metadata file … could not be found error when building projects

前端 未结 21 3246
北恋
北恋 2020-12-14 14:28

Every time I start Visual Studio 2008, the first time I try to run the project I get the error CS0006 The metadata file ... could not be found. If I do a rebuild of the comp

21条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 14:40

    If you use LinqtoSQL Data contexts, for instance, and the .designer.cs file is missing, you will get the Metadata file could not be found error.

    Recreating the designer.cs file is easy.

    Open up the dbml using xml view. Add a blank line, then remove it, then save. That should regenerate your designer.cs file.

    Under some circumstances, if you have code inside your data context's code-behind, this work around will not work. In this case, take the code out of the code behind and put it in notepad or something. Do the trick of adding then removing a line from the DC and save. Now put the code back and save.

提交回复
热议问题