VS 2017 Metadata file '.dll could not be found
Solution 1
The problem was that I had some other normal error messages in my project, and apparently after I fixed those and when I cleaned and built my project AGAIN, then all .dlls succeeded.
Make sure you don't have any other error messages in your project and if you do, fix those first!
Solution 2
Steps in Fixing this Error: MetaData File .dll could not be found.
Clean All Projects.
Unload All Projects.
Reload All Projects.
ReBuild Solution.
Then problem solved.
Solution 3
In my case, there was an error, but it was not properly parsed out by VS and shown in the "Error List" window. To find it, you much view the ol "Output" from build window and parse through the messages starting from top down and resolve the actual error. M$, please fix! This is a huge waste of time of the worlds collective developers.
Solution 4
Double check the name of your project folder. In my case my project folder was named with spaces in it. When I cloned the project from Team Foundation Server using git bash the spaces in the folder name were converted to: "%20". Changing those back to spaces fixed the problem for me.
Solution 5
I had this issue with a solution containing multiple projects.
It came from duplicating a .csproj and adding the copy to the solution. A .csproj file contains a <ProjectGuid>
element. I set the GUID of the copied project to a new one.
Update: Which GUID you use doesn't matter, it just needs to be different from the other project's GUID. You can create a new GUID from within Visual Studio: Tools -> Create GUID
and copy the part between the curly brackets, i.e. {...}
. Use that as the new value for the <ProjectGuid>
element.
I also performed the following steps (not neccessarily neccessary, but they don't hurt):
- Close the solution
- Delete bin folder
- Delete all obj folders
- Open solution and build
Related videos on Youtube
Svenmarim
Updated on February 27, 2021Comments
-
Svenmarim about 3 years
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 ASP.NET MVC project and joined a few '.dll's in the solution. Now when I try to build the project I get the error message shown below on 3 of the 5 libraries.
Error CS0006 Metadata file 'C:\Users\...\source\Database\bin\Debug\DataAccessLayer.dll' could not be found Logic C:\Users\...\source\Logic\CSC 1 Active Error CS0006 Metadata file 'C:\Users\...\source\Logic\bin\Debug\Logic.dll' could not be found PTS2-MVC C:\Users\...\source\PTS2-MVC\CSC 1 Active Error CS0006 Metadata file 'C:\Users\...\source\PTS2-MVC\bin\PTS2-MVC.dll' could not be found PTS2-MVC.Tests C:\Users\...\source\PTS2-MVC.Tests\CSC 1 Active
When I go to the bin\debug folder of that .dll, I see that it is empty, and the other .dll where I do not get an error message, is not empty. But I am clueless how to fix this or what I did to make this happen.
The most common answer is to go to the properties of the solution and go to configuration and uncheck -> apply -> check and apply again, but that didn't work
-
TheNoob almost 7 yearsJust a guess, but it seems like VS cleaned those out. Im not sure what those dlls are or where they are from, but if you're the one that made them I'd make sure whatever solution they are in built them. If these folders are from what your current solution is building to then it wont find these once you clean your solution again.
-
Asif Raza almost 7 yearsClean ^ rebuild || restart your visual , check again
-
Svenmarim almost 7 years@AsifRaza I litterly did that already so many times, but thinking with me :)
-
Svenmarim almost 7 years@TheNoob So you say i need to try and clean my solution and then build it? because i already tried that
-
Asif Raza almost 7 yearsdelete the all the from bin folder , then rebuild ^ check
-
Shanmukhi Goli almost 6 yearsThat issue mostly comes when you other build errors in any of the code files. Look at the output window for any errors not listed in the "Error List" window. This will give you a clue.
-
robs over 5 yearsThe suggested fix of solution property pages->Configuration then uncheck 'Build' for all projects, Apply and then recheck and Apply again fixed the problem for me. I started receiving two extra errors which were the source of the problem but not previously showing. Once they were fixed everything compiled.
-
camelCase about 2 yearsThis question Q& A thread lead to me solving my variation of the Metadata file problem. Unfortunately I will have to post my fix details in the much older alternative mentioned in the duplicate closure message above.
-
-
jbyrd over 6 yearsI actually had the same issue, but had no other Errors showing up, only the 1 error about the missing .dll. But then at some point (without me changing any code), suddenly a syntax error showed up that wasn't showing up before. Once I fixed that error, then like you said, I cleaned, rebuilt, and everything worked.
-
Santosh about 6 yearsSame issue here. There seems to be a bug in the Error List window where errors don't show up sometimes (and other times errors which were fixed continue to show up, despite doing a clean/rebuild). The Output window is more reliable so check there when you run into this issue.
-
Arsen Khachaturyan about 6 yearsThe same problem, because of STUPID VSTS.
-
user1431072 about 6 yearsI found that I had to enable warnings in my "error list" tab in visual studio. It was in the warnings that I saw that a referenced .dll could not be resolved. I had to remove the existing reference and add a new one in the correct directory. All is well now.
-
robs over 5 yearssee my comment above, but basically same thing except some bug in VS was stopping the errors from showing until I unchecked/checked the Build options in the Solution property pages.
-
BlueStrat over 5 yearsClosing Visual Studio (20127), then deleting
.svn
folder from solution folder did the trick for me. -
Alain Elemia over 5 yearsI changed directories of my projects causing problem with dll's not building using rebuild all and this answer fixes my problem.
-
canbax over 5 yearsThis should not be the answer 'cuz it is the most obvious thing that could happen. For me the solution was a DLL path was hard coded and it was missing
-
Svenmarim over 5 years@canbax, good for you that you found your own solution, but you can't say that this should not be an answer. Because apparently alot of people (including my self) forget this "obvious" answer. Alot of problems in SE are "obvious" problems, but it can still take hours before you finally figure out the issue.
-
Ishwor Khanal over 5 yearsIt was aspboilerplate architecure that I was working on and suddenly unexpected error happened and then started playing up that .dll was not found but it was the problem of other error as @Svenmarim mentioned in his answer. Thank you.
-
user3785553 almost 5 yearsThis was the exact reason for the above error. Thanks for the tip. it worked
-
Wojtek Turowicz almost 5 yearsSame here, but I had
%20
in the folder name. -
Vu Nguyen over 4 yearsThis really fixed my case.
-
Calum Mullen about 4 yearsThis resolved the issue for me. Tried all other solutions, but the output window pointed me to my project being built against netframework 4.7.2, which was higher than the targeted framework netframework 4.6. Just had to edit the .csjproj to point at 4.6.
-
Anthony Queen about 4 yearsSo, while it wasn't showing up as an error, there was a non-error blurb in the output window that keyed me in. I had references to a couple of .NET 4.6.1 assemblies, but my project was .NET 4.5. Make sure all your projects are at the correct .NET framework version.
-
Anthony Queen about 4 yearsSame thing here.
-
TyngeOfTheGinge about 4 yearsThis was absolutely the answer for me. Fix one "normal" error and all of those other dll errors went away.
-
James L. almost 4 yearsMy error was that I had an existing variable name as the name used inside a query ::
var wr = _repo.Query<WorkRequest>().Where(wr=> wr.Id == wrId).First();
. I fixed it by changing the inner variable toWR
instead. For some reason this build error is only visible in the output window :/ -
ikariw almost 4 yearsunloading and re-loading were the key for me. i spent a long time on this issue until doing that!
-
Banana Cake almost 4 yearsSame problem. The error didnt show in the error list, but after closing and reopenning VS, it showed the specific error.
-
ɐsɹǝʌ ǝɔıʌ over 3 yearsThis is the only answer that really helped me. Superb! Thanks!
-
Lasithe over 3 yearsThis was my solution
-
Heri over 3 yearsThe same in VS 2019: Just closing VS and re-opening the solution helped.
-
Masoud over 3 yearsThank you, after 5 hours searching & trying, your solution saved me:)
-
CipherShark about 3 yearsThis worked for me - nothing else did.
-
questions about 2 yearsthis was it for me too, but my project was on azure devops