I have been playing around with the Visual Studio RC version since few months now. Visual Studio 2017 was available for download on 7th March, 2017 – hence I thought of using it for my day to day development work. The good thing was that since I had the RC already installed, I just had to upgrade to get to the VS Enterprise version – which took me a few minutes. Earlier we had to uninstall the RC version and get a fresh new Visual Studio version installed. I must admit, the installation process is lot better now.
However I bumped into an issue when I opened my solution in VS2017 Enterprise.
I noticed that the Database Unit Test project fails to build. The same solution opens fine in Visual Studio 2015 Enterprise, so I think it’s a problem related with VS2017. I was not sure if there was any additional Nuget Package that needs to be installed. I did not find any documentation in MSDN about this.
Below are the error messages which I got —
The type or namespace name ‘Data’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)
The type or namespace name ‘SqlDatabaseTestClass’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘SqlDatabaseTestActions’ could not be found (are you missing a using directive or an assembly reference?)
Opening the References folder of the Database Test project,I saw the below 2 missing dlls –
Looks like it is related to SQL Server Data Tools and its support in VS 2017.
I reported the issue with Visual Studio Team yesterday and the issue is currently in a ‘Triaged’ state —
However after researching a bit more, I think I might have found a solution to get around/ fix this problem with Database Unit test Projects not building in VS2017.
It worked for me and I was able to build and run my project successfully. Try the below steps and let me know if it fixes the issue in your case too —
Right Click on the Database project, you will see an option – ‘Convert to SQL Server Unit testing project’
Once you click that, it will automatically update the Service References and prompt the final Conversion Report.
I went back to my Database Unit Test project and saw that the below new references were added —
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.
Related Posts on Visual Studio 2017 –