If you write code to SQL Server then you might be interested in this: I have written a tSQLt tdd training course which has helped over 500 people learn both tSQLt and how to apply TDD practices to their SQL Server T-SQL development, you can join the course at https://courses.agilesql.club.

ScriptDom versioning issues

I installed the 2016 SSMS client recently and in one way or another any of my apps that I have written that use the DacFx ScriptDom have all broken in slightly different ways. One app throws a type conversion error and another just failed to find any statements in a batch.

When I started debugging the problem I noticed that I got this when I started one of the apps from Visual Studion:

No way to resolve conflict between “Microsoft.SqlServer.TransactSql.ScriptDom, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91” and “Microsoft.SqlServer.TransactSql.ScriptDom, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91”. Choosing “Microsoft.SqlServer.TransactSql.ScriptDom, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91” arbitrarily.

I looked into it some more and because the ScriptDom is in the GAC, .Net ends up choosing the highest version available which in this case is a) a beta and b) not the version my app was created using.

To fix it I changed the properties of the reference in my project to be version specific:

Set the reference to ScriptDom.dll to be version specific

If you can’t rebuild your app for some reason then you can use the app.config to force it to stay at the correct version:

https://msdn.microsoft.com/en-us/library/7wd6ex19(v=VS.100).aspx (or if the url changes search for “Redirecting Assembly Versions”.