tSQLt will not build in Visual Studio 2022

260 views
Skip to first unread message

David Demland

unread,
Apr 13, 2022, 11:12:14 PM4/13/22
to tSQLt
I have a database test project and tSQLt has an error when build:

SQL71501: View: [tSQLt].[Private_HostPlatform] has an unresolved reference to object [sys].[dm_os_host_info].[host_platform].
SQL71501: View: [tSQLt].[Private_HostPlatform] has an unresolved reference to object [sys].[dm_os_host_info].
SQL71501: Computed Column: [tSQLt].[Private_HostPlatform].[host_platform] has an unresolved reference to object [sys].[dm_os_host_info].[host_platform].

I did not have these issue ion the last project I did with tSQLt, about three years ago and I am not sure how to clean these errors up. When I tried to remove the issues from the DB tSQLt stopped working. How do I fix these build issues?

Thank You,

David

Naimish Randeri

unread,
Oct 24, 2022, 10:52:38 PM10/24/22
to tSQLt
Hey David,

Did you fix this error? I have the same issue. I am new to tSQLt and I am using Visual Studio 2022.

Please any help.

Cheers,
Naimish

Sebastian Meine

unread,
Oct 25, 2022, 8:34:59 AM10/25/22
to ts...@googlegroups.com
Naimish, 

This is not an “error” in tSQLt. It is likely due to the wrong database version being used in your project. 
 
There are several places where that could happen. I’d start with making sure you are using the correct tSQLt dacpac, and you have set the correct SQL Server version in your project. They must match each other, and they must match the version of SQL Server you are planning to deploy in. 

Then make sure that you point your project to an actual SQL Server instance (again, same version), and not the reduced implementation that comes with visual studio. You find that setting under project properties/debug. (Keep in mind that SQL Server developer edition is free.)

There are more things that could be off in your project, but it’s probably one of the above. 

Good luck. 

Sebastian

--
You received this message because you are subscribed to the Google Groups "tSQLt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tsqlt+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tsqlt/19d402d9-c023-4eec-90b3-b6e924b89834n%40googlegroups.com.
--
Thanks,

Sebastian

djla...@gmail.com

unread,
Oct 25, 2022, 4:15:21 PM10/25/22
to ts...@googlegroups.com
Hi Naimish:

Tbh I don't remember that error, but as I did post it, there's no doubt it happened.  We have been using tsqlt intensively for the past 4 years, and haven't had a recurrence of this, so I would follow Sebastian's advice.  Thanks Sebastian for the product and the support!

Doran

unread,
Oct 25, 2022, 4:18:50 PM10/25/22
to tSQLt
When I use tSQLt, I have 2 database projects in my Visual Studio solution.  One for the "regular" database code and the second for the tSQLt code.  You need to provide a database reference from the tSQLt project into the regular database project or you will get those reference errors.  When you deploy the code, you publish the first dacpac and then the seconds and turn off the delete on objects not in the dacpac so they don't clobber each other.

This setup enables you to deploy testing to specific environments and not to your production environment when that is required.

The easiest way to get the second database project is to use the tSQLt script to deploy into a blank database and then import the database into tSQLt project.

Reply all
Reply to author
Forward
0 new messages