Upgrading from Visual Studio 2015 to Visual Studio 2017


Visual Studio 2017 comes with a lot of new capabilities and productivity enhancements. This was good enough reason to start moving from VS 2015 to VS 2017, and leveraging all the new features. In this blog post, I will mention about couple of issues which I bumped into during the migration process and the action items I took to resolve those.

If you have a .NET Core Project to migrate, you can open the .xproj file with Visual Studio 2017, and the ‘One-way upgrade‘ dialog will appear. It will assist you to migrate the file to the .csproj format automatically. There is no manual editing required. Once the migration is complete, the browser will open the Migration Report, with all the details and at that point you can view your pending changes the migration process made, and check it in to your source control. You should see that the old project.json file and the .xproj file is now removed, and the new csproj files are added back. Now you are all set to start working in Visual Studio 2017.

Core Projects

I had an ASP.NET Web Application to migrate, so it was pretty easy and everything worked just fine, when I opened the solution file in VS 2017. However I bumped into 2 different issues, which I want to mention in this blog post.

Database Unit Test project fails to build

If you have a Database Unit Test project in your solution and try to open it with Visual Studio 2017, then you will get build errors —

Database project Build Errors

However after researching a bit more, I found a solution to get around/ fix this problem with Database Unit test Projects not building in VS2017.

Right Click on the Database project, you will see an option – ‘Convert to SQL Server Unit testing project’

SQL Server Unit Testing Project

Once you click that, it will automatically update the Service References and prompt the final Conversion Report.

Conversion Report

I went back to my Database Unit Test project and saw that the below new references were added —

Microsoft.Data.Tools.Schema.Sql.dll
Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll
Microsoft.Data.Tools.Schema.Sql.UnitTestingAdapter.dll

Updated References

Now when I built my project, everything ran fine and I was able to get rid of the Build Errors and all my database unit tests ran fine.

When I posted this solution in forums, there were few folks who said that they do not see the option – ‘Convert to SQL Server Unit testing project’, when they right click on the Database project. In that scenario, you can manually add the above references, and the project should build.

Live Unit Testing fails to start

When you turn on Live Unit Testing for your project, there are chances that it might fail to build. In my case, I received the below error message in the Output window —

[15:29:23.720 Info] Live Unit Testing started.
[15:30:32.559 Error] Project C:\ConCode.csproj has an unsupported reference to a test framework ‘Microsoft.VisualStudio.QualityTools.UnitTestFramework’. To run tests, remove this reference from the project and add a nuget reference to ‘MSTest.TestAdapter’ and ‘MSTest.TestFramework’ instead.
[15:30:33.268 Info] Build completed (failed).

If you are using MSTest, then you will need to remove the reference to ‘Microsoft.VisualStudio.QualityTools.UnitTestFramework‘ in respective projects and add the new adapter and framework dlls –
MSTest.TestAdapter
MSTest.TestFramework

TestFramework

TestAdapter

Additionally I have seen some other issues with Live Unit Testing, which I will cover in my next blog.

How has been your upgrade experience to Visual Studio 2017? Do post your comments, if you faced some other issues.



Categories: C#, Visual Studio, Visual Studio 2017

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: