Metadata file … could not be found error when building projects

前端 未结 21 3047
北恋
北恋 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:52

    Same thing happened. I have several solutions referencing the same library projects (.net 3.5). I noticed when one was built in debug/normal config, and another using some other compiler directive (sqlite/local mode), this would happen. Simply get both projects building with the same directives and you should be fine.

    0 讨论(0)
  • 2020-12-14 14:52

    I got stuck with the save issue when I wanted to include a dll file generated by Matlab. And I finally solved it by copy a .ctf file, which means certificate I suppose, and a .netmodule, which is needed for proper operation of the .dll, along with the .dll file. And that actually worked! So, my suggestion is to check if the .dll needs any other files to get along with.

    0 讨论(0)
  • 2020-12-14 14:53

    The only thing that fixed me (because I'm not running VS2010 on an administrator account) is to manually move the environment variable VS120COMNTOOLS from System Variables to User Variables.

    0 讨论(0)
  • 2020-12-14 14:54

    i had the similar issue where "metadata could not be found". on the solution property, make sure that the "build" check box is marked in Build/Configuration Manager for each project.

    0 讨论(0)
  • 2020-12-14 14:54

    I have a couple of points I would like to make.

    If you are relying on the solution file as your build file under MSBuild, ensure that you add projects to the solution file in the order in which you want them to build, i.e., based on the mutual dependency order of the projects. This becomes very important if you have projects in the solution that other projects depend upon, but the references have been added as "References" rather than as "Project References".

    You should avoid that like the plague, but in case you do need to do that, then at least make sure the dependent projects appear earlier in the solution file.

    You should bear in mind that the way Visual Studio generates build order is not exactly the same as the way MSBuild does it. This is because MSBuild primarily depends on the project file to tell it what the dependencies are, whereas Visual Studio can also save them in the soltuion file. Therefore, you can sometimes see situations where Visual Studio builds the solution perfectly, but MSBuild just can't do it.

    I have had a couple of instances where I had to hand tweak the order in which the projects appear in the solution file as well as the order in which the projects were listed in the ProjectReferences element in a Web Site project in the solution file.

    I hope the above information helps.

    0 讨论(0)
  • 2020-12-14 14:58

    First make sure that the "build" check box is marked in Build -> Configuration Manager for each project.

    In case, if you already have all projects selected under Build -> Configuration Manager menu, and restarting VS trick doesn't work for you either than you have to find the reference of the file(s) (could be dll or cs) in your project and delete those references manually. Those file(s)/reference(s) should be displayed with yellow icon. The error definitely guides you which project of solution you should be looking into.

    The reason of this error is because you have deleted file(s) manually in windows explorer and VS hasn't updated the reference and trying to locate the file which doesn't exist anymore!

    0 讨论(0)
提交回复
热议问题