VS 2017 Metadata file '.dll could not be found

后端 未结 28 1258
日久生厌
日久生厌 2021-01-31 07:06

I know there is another question with exact the same problem, but I went trough all those answers, and none helped me. :( (This was the question.)

I just created a new A

相关标签:
28条回答
  • 2021-01-31 07:28

    In my case, I deleted one file directly from team explorer git menu which was causing this problem. When I checked solution explorer it was still showing the deleted file as unreferenced file. When I removed that file from solution explorer, I was able to build project successfully.

    0 讨论(0)
  • 2021-01-31 07:30

    In my case the issue was, I was referencing a project where I commented out all the .cs files.

    For example ProjectApp references ProjectUtility. In ProjectUtility I only had 1 .cs file. I wasn't using it anymore so I commented out the whole file. In ProjectApp I wasn't calling any of the code from ProjectUtility, but I had using ProjectUtility; in one of the ProjectApp .cs files. The only error I got from the compiler was the CS0006 error.

    I uncommented the .cs file in ProjectUtility and the error went away. So I'm not sure if having no code in a project causes the compiler to create an invalid assembly or not generate the DLL at all. The fix for me was to just remove the reference to ProjectUtility rather than commenting all the code.

    In case you were wondering why I commented all the code from the referenced project instead of removing the reference, I did it because I was testing something and didn't want to modify the ProjectApp.csproj file.

    0 讨论(0)
  • 2021-01-31 07:31

    I had the same issue. My problem was someone else on the team moved a class folder, and the project was looking for it.

    For me, there were 44 errors; 43 ended in .dll (searching for a dependency) and the first one in the error list ended with .cs (searching for the actual class). I tried clean-build, and clean, unload, reload, build, but nothing working. I ended up locating the class in the project, and just deleted it, as it was showing up as unavailable anyways, followed by a clean-build.

    That did the trick for me! Hope this helps.

    0 讨论(0)
  • 2021-01-31 07:32

    For me what worked was:

    Uninstall and then reinstall the referenced Nuget package that has the error.

    0 讨论(0)
  • 2021-01-31 07:33

    Another thing that you should check is the Target Framework of any referenced projects to make sure that the calling project is using the same or later version of the framework.

    I had this issue, I tried all of the previously suggested answers and then on a hunch checked the frameworks. One of projects being referenced was targeting 4.6.1 when the calling project was only 4.5.2.

    0 讨论(0)
  • 2021-01-31 07:34

    Running this command in bash to delete all bins worked for me

    $ find . -iname "bin" -o -iname "obj" | xargs rm -rf
    

    Can't guarantee it'll work for anyone else though

    Also be aware it'll delete all bin files -so you will have to rebuild all projects. Obviously best to cd into the relevant directory before using it.

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