Visual Studio is very good at migrating solutions and projects from its older versions. However everything has limits, and I’ve seen a few very rare cases where it doesn’t quite work. The main problem I’ve encountered can be recreated as follows:
Using Visual Studio 2017, migrate a .NET 1.1 ASP.NET solution and its projects to .NET 4.6 or later, and add a new unit test project (either a test project or class library). Use NuGet to install NUnit 3 as a dependency for your test project, and add the NUnit 3 Test Adaptor. Create a few NUnit unit tests in the new test project and save everything.
Open the Test Explorer, and there’s a good chance that Visual Studio won’t detect any of the unit tests. There are a few suggestions on the web to solve this, but none of them worked for me. The solution that did was just to make a backup copy of the project(s) that you migrated, delete the originals and then recreate them using Visual Studio 2017. Copy your original
.CS files back to the new directory and add them to the new projects. Copy the custom settings from the old
.config file to the new one, reload the solution, and Visual Studio should now detect all of the NUnit tests and let you run them.
I’ll cover when, why and even whether you should migrate .NET code as old as v1.1 in another article.