Build/Test Issues

Metadata file 'Microsoft.Codeanalysis.Analyzers.dll' could not be found

Started by Mangust on 17,582 views

I have a very simple solution with few project that have a nuget reference to 3 rolsyn packages, the solution builds fine but ncrunch says this:

NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
CSC (0, 0): Metadata file '..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll' could not be found
CSC (0, 0): Metadata file '..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll' could not be found

All of the projects with nuget included are not built.
I have just updated to the latest ncrunch 2.16 , but I have not tried to run it on the earlier versions so don't know if they worked.
Is there anything I can do to make it work?

Edited

Do you mean that the assemblies that are referenced by my projects are fine, but those assemblies that fail are referenced indirectly via the ones that are included in my project?
In this case isn't it possible to find all the indirectly referenced assemblies and copy them for ncrunch to use? Or that is too hard to implement?

P.S. This did work indeed, thank you for help. But I would still expect that this works explicitly, because this seems like a very common problem. I.e. if those files are found and reported to be unavailable, can't Ncrunch just add them automatically e.g. or analyze references, etc.?

Edited

Mangust wrote:Do you mean that the assemblies that are referenced by my projects are fine, but those assemblies that fail are referenced indirectly via the ones that are included in my project?
In this case isn't it possible to find all the indirectly referenced assemblies and copy them for ncrunch to use? Or that is too hard to implement?


Not exactly. The projects and assemblies referenced by your solution are fine, and NCrunch has detected them. The analyzer assemblies are different as they are referenced by code included inside the build process - they aren't actually 'declared' dependencies.

Mangust wrote:
P.S. This did work indeed, thank you for help. But I would still expect that this works explicitly, because this seems like a very common problem. I.e. if those files are found and reported to be unavailable, can't Ncrunch just add them automatically e.g. or analyze references, etc.?


A few people have been hit with this, so it does seem to be a common problem with the newly introduced analyzers. The NCrunch approach with undeclared dependencies (such as those deep within build steps) has been to simply try and educate people about implicit dependencies so that they understand how to correct the problem manually.

I guess a good comparison could be something like a VCS. Most VCS software is reliant on the developer to declare which files are actually source code and therefore should be introduced to the VCS. It could be considered possible for VCS software to try and determine this programmatically (for example, by parsing solution and project files or by using wildcards), but this would never be 100%. NCrunch follows the same logic - for the sake of convenience, it does its best to try and determine which files should be in the workspace and which shouldn't. In some ways it's a testament to how well it does this that people hit situations where files haven't been automatically resolved and feel it to be a defect in the product.

I'm looking at ways in which this can be improved for certain Nuget packages, but it's hard to do this reliably without unnecessarily bloating the workspace with unneeded files.

Post a reply

Log in to reply.