Dapper and Microsoft.SqlServer.Types

·

1 min read

Hello dear reader. Did you just get some vague error that read something like the following:

Could not load file or assembly 'Microsoft.SqlServer.Types' version x.x.x.xxx

Instead of thinking you have some kind of Assembly hell problem after digging through and applying nuget packages, just check what you are returning in your query. If you have a HierarchyId and are trying to call something like QuerySingle you'll have a problem.

The easiest solution, use ToString on your query and move on with life.

SELECT path_locator.ToString() FROM FileTable