12

Due to some git project changes, when I try to build, I get an error:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props.

The references to the project contain four missing references, two of which Microsoft.VisualStudio.TestPlatform.TestFramework, and Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions which seem to be related.

The other two, in case it proves to be relevant are System, and System.Core, but they aren't causing any problems... which is weird, cause I'm definately using them.

That missing file, the one from the error message, is absolutely there.

I've tried to uninstall and reinstall both packages, but nothing seems to help.

1
  • I was getting this error because I was trying to use dotnet restore <sln file name> instead of nuget restore <sln file name> before running dotnet build <sln file name>. With nuget restore <sln file name> it started to work.
    – tolache
    Commented Dec 15, 2020 at 12:31

4 Answers 4

16

Open the projects .csproj file with your favourite text editor and delete any references to

MSTest.TestAdapter.props.

Edit: This is safe to do so, all that happened is that you have removed the DLL but for one reason or another your project file still references it as a dependency.

3
  • Is that safe to do?
    – pushkin
    Commented May 9, 2018 at 18:05
  • 1
    In my case, VSTS started to see missing libraries like Moq, MSTest and so on. This answer, unfortunately, does not clarify why this automatic reference to props can be deleted... Commented Jul 20, 2018 at 7:42
  • For me it was a case of the package folder moving up a level. The project file keep the old reference and it wasn't apparent until we attempted to auto deploy. Avoid deleting the good reference if you see multiple entries in your project file or you could have further issues. Commented Apr 1, 2020 at 2:06
8

I would modify @JoshuaDuxbury's answer to say: you need to clean out obsolete references to MSTest.TestAdapter.props.

In my case, I had just updated the MSTest.TestAdapter NuGet fronm 1.3.2 to 2.0.0, but apparently when I did that, Visual Studio didn't clean up my .csproj file perfectly.

So, I had to delete the superflous MSTest.TestAdapter.props highlighted in two places:

Near the top of the project file: delete the highlighted line of code if you have two

...and again at the bottom of the file: enter image description here Once I did that, my CI pipeline was able to build everything correctly again.

Some of you with sharp eyes may notice something funny w/the 1.3.2 of MSTest.TestAdapter shown above: it seems the path to the packages folder is off! But that would be a topic for a different thread (or maybe an alternate explanation to why your build pipeline is unhappy.. maybe just fix your path to packages).

0

My issue didn't occur on my development box but on the Azure Build Pipeline. I removed the offending props files as per the other answers but to no avail. Ultimately I had to add the Nuget restore step to my the Azure build pipeline and move it to the proper slot before the building:

enter image description here

0

I have no idea how I've done it but I've had the same error and I thought the files were here but they actually weren't... so anyone who has this issue double check the paths. In my case the Packages folder was at the same level as the project file however it was looking for files in the parent directory. Nuget restore and Update-Package -reinstall were not fixing anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.