Could not find VS 2017 metadata file .dll file.

I know that there is another question with exactly the same problem, but I went through all these answers and no one helped me. :( ( That was the question. )

I just created a new ASP.NET MVC project and joined several.dll in the solution. Now, when I try to build a project, I get the error message shown below in 3 out of 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 into the bin \ debug folder of this DLL, I see that it is empty, and the other DLL in which I do not receive an error message is not empty. But I don’t know how to fix it or what I did to make it happen.

The most common answer is to go to the solution properties , go to settings and uncheck β†’ apply β†’ check and apply again, but this did not work

+53
c # asp.net-mvc visual-studio-2017 metadata
source share
28 answers

The problem was that I had other regular error messages in my project, and, apparently, after I fixed them, and when I AGAIN cleaned and compiled my project, all .dlls were successful.

Make sure you have no other error messages in your project, and if so, fix them first!

+64
source share

Steps to fix this error: MetaData .dll file not found.

  • Clear all projects.

  • Unload all projects.

  • Update all projects.

  • ReBuild Solution.

Then the problem is solved.

+18
source share

I had this problem with a solution containing multiple projects.

I think this came from duplicating .csproj and adding a copy to the solution. The .csproj file contains the <ProjectGuid> element. I set the GUID for the copied project to a new one.

I also performed the following steps:

  • Close the solution
  • Delete bin folder
  • Delete all obj folders
  • Open solution and build
+7
source share

In my case, an error occurred, but it was not correctly analyzed by VS and is shown in the "Error List" window. To find it, you see a lot of "Exit" from the assembly window and analyze the messages, starting from top to bottom, and resolve the actual error. M $, please correct! This is a huge waste of time for the developers of the collective world.

+7
source share

Double check the project folder name. In my case, my project folder was named with spaces in it. When I cloned a project from Team Foundation Server using git bash, spaces in the folder name were converted to: "% 20". Changing these objects in space fixed the problem for me.

+5
source share

I fix this problem by following these steps:

  1. Clean solution
  2. Close Visual Studio
  3. Removing / bin from the project directory
  4. Restart Visual Studio
  5. Restore solution
+4
source share

I had the same problem, even after the Rebuild Solution, there were no other errors in the Error List view. However, in the Output view, I found an error that was behind this problem:

The primary link "C: ... \ myproj.dll" cannot be resolved because it is built on the basis of the .NETFramework platform, Version = v4.6.1. This is a higher version than the current target platform. NETFramework, Version = v4.5

As soon as I fixed it, the problem was resolved.

+3
source share

I have the same problem, the problem is that the solution path has spaces in the name and vs for some reason does not allow the package ... download my repository again by simply renaming the solution with spaces in the name.

eg:

 /Repo/Project Name/src 

it should be

 /Repo/ProjectName/src 
+2
source share

For me, cleaning and construction did not work. Unloading the project did not work. Restarting Visual Studio or even the computer did not work. Here's what worked:

Go to each of the projects that throw an error, and in the "Links" section, delete the link to the problematic project and add it again. This solves the problem.

It seems that the problem is with moving the project (for example, moving it to a folder), and then another project that refers to it has the wrong path and cannot find it.

+2
source share

In my case, I had to open the .csproj file and manually add the link, for example, like this (Microsoft.Extensions.Identity.Stores.dll was missing):

 <Reference Include="Microsoft.Extensions.Identity.Stores"> <HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.identity.stores\2.0.1\lib\netstandard2.0\Microsoft.Extensions.Identity.Stores.dll</HintPath> </Reference> 
+2
source share

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

I had this problem, I tried all the previously suggested answers, and then checked the framework on suspicion. One of the referenced projects was aimed at 4.6.1, when the calling project was only 4.5.2.

+1
source share

In my case, I encountered the same error. One of my design decisions was about building from various places in NuGet. I just changed it to fix the location, to solve this error and rebuild. and wow the project will work successfully, and all other errors have disappeared.

+1
source share

Running this command in bash to delete all used boxes for me

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

It’s not possible to guarantee that this will work for someone else, but

Also keep in mind that it will delete all bin files, since you will have to rebuild all projects. Obviously, it is best to use cd in the appropriate directory before using it.

+1
source share

Check all projects are uploaded. In my case, one of the projects was unloaded, and reloading the project removes the errors.

+1
source share

Close Visual Studio, find the .suo solution file, delete it, open Visual Studio again.

+1
source share

Cleaning up my solution caused this problem with Visual Studio 2017. Unloading / reloading projects or doing additional cleanup didn't matter. The only thing that worked was closing and restarting Visual Studio.

0
source share

This problem occurs when you rename your solution, and the .net Framework cannot find the old solution.

To solve this problem, you need to find and replace the old name of the solution and all the dependencies on it with the new name. If you need to view a physical file through Explorer, do it.

The following files are typically affected: AssemblyInfo.cs , .sln a Properties > Application > Assembly Name Properties > Application > Assembly and Default Namespace. Be sure to update them with a new name.

Open Explorer, if the folder with the old name still exists, you need to delete it. Then clean and build the solution until the error goes away. (If necessary, clean and build the project one by one, especially the affected project.)

0
source share

I had the same error. In my case, I built a library (call it commsLibrary) that referenced other libraries, including them as projects in my solution. Later, when I assembled the project and added my commsLibrary , whenever I was going to build, I received a metadata file, but no error was detected. So I added libraries that my comms library referenced in the current project, and then was able to compile them.

0
source share

Switching configuration from release - any processor to release - mixed platforms solved my problem. I suspect that the project uses class libraries that use 32-bit COM objects.

0
source share

Faced with so many troubles, here is the solution I found.

  1. open your project folder.
  2. find Your_Project_Name.csproj [Visual C # Project File (.csproj)]
  3. open this file in any text editor and find the missing ItemGroup file.

    <ItemGroup> <None Include="..."/> </ItemGroup>

  4. delete ItemGroup and open your project again and build

  5. If this link is important to you, add it again.
0
source share

I have links to other .csproj files in my solution, and after upgrading to .NET Core 2.2, I somehow started getting this error. This is fixed with the inclusion of Show hidden files in Explorer (.csproj files are hidden and for some reason VS cannot find them because of this)

0
source share

I had the same problem. My problem was that someone on the team moved the class folder and the project was looking for it.

There were 44 errors for me; 43 ended with .dll (dependency search), and the first in the list of errors ended with .cs (actual class search). I tried to clean-assemble and clean, unload, reload, assemble, but nothing worked. I ended up finding the class in the project and simply deleting it, as it still seemed to be inaccessible, followed by a clean build.

It helps me! Hope this helps.

0
source share

I had 2 files (and 2 classes) in one project with the same name.

0
source share

In my case, I deleted one file directly from the team explorer git menu that caused this problem. When I checked the solution explorer, it still displayed the deleted file as a file with no links. When I deleted this file from Solution Explorer, I was able to successfully build the project.

0
source share

For me, what worked was:

Uninstall and then reinstall the specified Nuget package in which the error occurred.

0
source share

I had the same problem and I tried solving from the metadata file .dll could not be found

but none of this worked.

Thus, after trial and error, I fixed it by unloading and reloading the project, completing this, resetting the configuration file and fixing the problem.

0
source share

In my case, I ran the tests and got the error CS0006. It turned out that I am running tests in Release mode. Switching to debug mode fixed this error.

0
source share

What worked for me:

Package Manager Console (Visual Studio 2019 Comunity):

 Install-Package NuGet.CommandLine nuget locals all -clear 

Recover the solution.

0
source share

All Articles