MSTest cannot find TestAdapter.dll - visual-studio

I'm using the built-in Visual Studio test tools (Test -> Run -> etc in the menu). I just started having a problem where I get the following error when I try to run tests
[3/29/2018 1:39:14 PM Error] System.IO.FileNotFoundException: C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
at Microsoft.VisualStudio.TestWindow.Controller.TestPlatformProvider.PerformShadowCopy(IEnumerable'1 testExtensions)
That's followed by some errors that say
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
When I look at the folder C:\Users\brubin\AppData\Local\Temp\VisualStudioTestExplorerExtensions\MSTest.TestAdapter.1.1.18/build/_common/, there are no files in that folder. However, I haven't knowingly changed anything about my test setup and this was working several days ago, so I don't know why it would have stopped working.
My projects are using the MSTest.TestFramework (MSTest V2) version v1.2 NuGet package.
One thing I noticed that may have caused this problem is that if I go to Tools -> Extensions and Updates, I see that my Microsoft Visual Studio Test Platform was updated a few days ago, on 3/23 (I think that's when I installed a Visual Studio update). However, if that broke something, I have no idea where to look to see what's broken, or how to fix it.

For me, clearing the VisualStudioTestExplorerExtensions folder and restarting Visual Studio (as per this github issue) did the trick. In my case, it contained two folders for different versions of MSTest.TestAdapter, I don't know whether or not that's relevant.

For anyone else who stumbles on this question, the problem was caused because a few of my test projects didn't have the MSTest.TestAdapter NuGet package included. I added the MSTest.TestAdapter package to all of my test projects, and the problem seems to be solved permanently now.

I spent the whole last week trying to solve the same issue. Only yesterday did I realize that running tests from the console is a time saver. Much to my surprise, I've just moved all my project -which was inside a "OneDrive" folder, to a different location. Now, it works like a charm! All my tests run from the Visual Studio IDE. I don't know if moving the files had anything to do with it, but you can give it a try.

Reinstalling all solution's Nuget packages fixed this issue for me.
Please run this command on the package console:
Update-Package -reinstall
then try again, or restart VS, then try again.
Reference: https://ardalis.com/force-nuget-to-reinstall-packages-without-updating/

Its a bug in Visual Studio. Upgrade the Visual Studio to version 15.7.
https://developercommunity.visualstudio.com/content/problem/222892/filenotfoundexception-microsoftvisualstudiotestpla.html

Yes you need to update "MsTest.TestAdapter" on all testprojects. The easiest way is to rightclick on master solution and click on manage nuget-packages. Then select " installed " tab and see if there is installed TestAdapter on each testprojects. If necessary you can update TestAdapter to newest version. Then restart Visual Studio and it should work.

Related

Visual Studio (Community 2019) throwing errors which should be warnings regardless of settings in one project only

A couple of weeks ago I cleared the NuGet cache in Visual Studio... this broke everything for some time as it would not automatically restore all the NuGet packages for some reason.
After a lot of effort and manually restoring stuff, I have now got most projects in my (quite large) solution working, except one.
I am in the process of moving most of my code from .NETFramework projects, to .NETStandard and the websites to .NETCore, that in itself is a headache and may/may not be related to the problem, but I don't think so.
Anyway, this one project, which is a .NETFramework (4.7.2) web application and references many other projects in my solution, will not build properly.
Each time I build it, I get thousands of stupid errors from MSBuild, see the screenshot (ignore the top 4,they are genuine!). These are all errors which should be warnings, or ignored.
In the Project settings page I do NOT have "treat all warnings as errors" checked - in fact, in an effort to fix this, I have turned warnings off altogether as well.
The weird thing is, that if I build every individual project in the solution first, usually twice, and then build this one with out touching anything else, it then will build and launch in IIS (or publish)
So the site is actually working but something is wrong in MSBuild or VS that is breaking it.
I have tried running a Visual Studio repair, but that made no difference either.
EDIT also, it only does it on one PC, if I load the same solution onto my laptop, it will all build fine.
And from some of the errors, if seems that the you should change the Assembly Name of the SAM project to Sam. It is quite strange. Not sure whether you have install some extra Code Analysis extensions on your current PC but other PCs works well.
So please try the following steps:
Steps
1) disable any third party installed vs extensions under Extensions-->Manage Extensions-->Installed
It needs a restart.
2) run update-package -reinstall under Tools-->Nuget Package Manager-->Package Manager Console
3) close VS, delete .vs hidden folder under the solution folder, every bin and obj folder of the projects under the solution.
Besides, you could use devenv /safemode to start a initial VS without any third party tools to test whether the issue happens.

Error while adding NuGet Package

I am getting the following exception while adding NuGet package to project. I am using the latest version of Visual Studio 2017 Pro.
try going to VS settings -> NuGet settings -> clear the NuGet cache, close Visual Studio, and delete all obj and bin folders in solutions .
Error while adding NuGet Package
AFAIK, It seems an issue which needs to be fixed from Xamarin team and someone already reported it:
https://bugzilla.xamarin.com/show_bug.cgi?id=61113
You can track this thread to get future updates for this issue.
Here are some of the workarounds already mentioned in that thread:
Update the packages with the option -IgnoreDependencies in the Package Manager Console (It works for me):
Update-Package -IgnoreDependencies
Update Visual Studio to latest version and running as Administrator
Some of the files in the packages folder were set to read-only. Try to cleare the read-only flag from all files in the packages folder.
Hope this helps.
I tried a lot of ways to solve this problem. But unfortunately cleaning the cache, project, rebuilding didn't help. The only thing I didn't try is to re-install Visual Studio or Windows.
I've got to launch project in Visual Studio for Mac and update/add all the necessary Nuget packages from there. On the Mac, the process was successful. I know this might not be an option if you don't have device, but it definitely works.

Package Installation Error Microsoft.NetCore.UniversalWindowsPlatform.5.0.0

I just did a fresh install of visual studio community edition.
When I start a new project and choose 'Blank App (Universal Windows)' I get this error during project creation:
Package Installation Error
Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files (x86)\Microsoft SDKs\NETCoreSDK':
Microsoft.NetCore.UniversalWindowsPlatform.5.0.0: Package restore failed. Rolling back package changes for 'AppTest'
Any ideas what the cause of this error can be?
I installed all the Universal Windows App Development Tools:
- Tools (1.3.2) and Windows 10 SDK (10.0.10586)
- Emulators for Windows 10 Mobile (10.0.10586)
- Windows 10 SDK (10.0.10240).
What am i missing. How can I solve this issue?
Sometimes nuget fails to install the UniversalWindowsPlatform package. Search for "Microsoft.NETCore.UniversalWindowsPlatform" nuget package and install it.
This is not an answer, I have the exact same issue and I have found other people with the same issue on the web, no one has come up with a solution yet.
This is upon creation of 'any' UWP project type, blank, templated, VB, C#.
This dialog pops up:
I have already found and tried all of the steps mentioned by Jay Zuo. This is actually for a slightly different issue, the dialog is exactly the same apart from the bit, where we have ': Package restore failed.'
They are getting ': Solution is not opened or not saved'
None of the steps on that post help resolve this issue.
I have tried restoring VS, Reinstalling the Windows 10 SDK, resetting VS using the various options to reset user data, environment etc, made sure the path to the SDK files exists.
Nothing has worked and my VS2015 Community is utterly useless right now for working on UWP projects. This is a new Windows 10 / VS install (VS on insider fast PC has no issue at all but I need this one on production build).
I am posting as an answer as I do not have enough points to comment but starting a new thread seems daft as this is the exact same issue, I just want to add more detail to it.
I had the same probem after a clean install of OS/Updates/VS 2015 Update 3 + Xamarin update. I created a Universal 'Blank XAML App (Xamarin Forms Portable)' During creation I received same error.
In the Nuget Package Manager Console pick AppX.UWP, then run:
Install-Package Microsoft.NETCore.UniversalWindowsPlatform
Restart VS and create a new project, error does not come back.
So after much back and forth between myself and an MS rep on their forums I did actually manage to resolve this.
The forum link is here
I did actually need to reset my VS installation to try and get a clean install.
Then the actual error reared its head. In my case it was Nuget caching corrupt packages (these are not cleaned by a VS reinstall).
The link that helped me resolve it in the end can be found here on Stack Overflow
What helped me was to update the UniversalWindowsPlatform package in nuget to 5.1.0. Then all went smoothly the next time I created UWP project.
Upgrading the package Microsoft.NetCore.UniversalWindowsPlatform.5.2.2 worked for me...
After facing a similar problem with Microsoft.NetCore.UniversalWindowsPlatform.5.2.3. I found a solution which might help someone. I navigated to my ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Net.CoreUWP,version=1.0.4 and ran the netfx_NETCoreUWP.exe. It did resolve my problem
Just as a reference...
My NugetPackage "'Microsoft.NETCore.UniversalWindowsPlatform" disappeared from my project references. It showed up as installed in NuGet. I uninstalled and re-installed without success. I restarted Visual Studio and re-installed and the package reappeared :-) !

"Enable NuGet Package Restore" is gone in VS 2015

I am having serious problems getting Solutions to build in Visual Studios 2015. Before I would just click "Enable NuGet Package Restore" in Visual Studios 2013 and everything comes in just fine.
I see this exact same question how-to-enable-nugets-package-restore-in-vs-2015
the answer was:
delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.
pardon my French, but besides this being bullshit. The fact that you have to manually go into every single project in your solution and mess around , it also is not working for me. Maybe the guy that wrote this had 3 or 4 projects , I have 30+ that are referenced.
That was back in June , has anyone found a working or simpler way to achieve this functionality that was working perfectly prior to VS 2015?
This setting is on by default since NuGet 2.7. Use a small Powershell script to migrate from the old MSBuild to the automatic restore of 2.7 to fix your issues.
When a package is not installed you see this dialog at start of the build process where NuGet restores the missing package:

Visual Studio 2013 New Project .csproj not supported

When I try to create a new Windows Forms project, I get the " ....csproj cannot be opened because its project type (.csproj) is not supported by this version of the application" error. The .csproj file it is referring to is in AppData\Local\temp\randomname\Applicationname.csproj but that file does not actually get created.
I know that when this error crops up with opening projects created in previous versions, it's usually a missing library that is used by that particular project but for the life of me, I cannot figure out what library I could be missing here as it is a new project.
I have VS 2013 Ultimate installed with all components.
Running on Windows 8.1.
First confirm it is not a add-on or a problem with Visual Studio itself.
Try and start Visual Studio from the command line with devenv.exe /resetskippkgs and also try disable any IDE extensions temporarily to see if one of them might be stepping on something. Do these two things first to see if the problem lies with VS IDE. Of course try creating a project after you have done these two things and see if you get the same results.
I never figured out what the actual problem was but I've installed Update 5 which was only released less than two weeks ago and it's working fine now.

Resources