tSQLt V1.0.8083.3529 will not build in Visual Studio 2022

489 Views Asked by At

I have a database test project and tSQLt has an error when I do a 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].

If I remove the files:

tSQLt\Functions\info.sql

tSQLt\Functions@tSQLt_RunOnlyOnHostPlatform.sql

tSQLt\Views\Private_HostPlatform.sql

I can get the project to build, but it will not publish because of an error with tSQLt. I did not have this issue on the last project I did with tSQLt, about three years ago and I am not sure how to clean these errors up. How do I fix these build issues?

Thank You,

David

1

There are 1 best solutions below

1
On

we're experiencing the same issue over here. just opened the same GIT project in both versions. builds fine in 2019 but 2022 fails for same error reference. noticed before when i had this problem, it was a version of master DB that was different than project version.

Edit:

so i figured out the exact issue i was having. it appears that those views are not included in the Master DB when using Target Platform of "Microsoft Azure SQL Database". if you select "SQL Server 2019 or Azure SQL Database Managed Instances", it has no problems finding those views.

if you read the "Features of..." section here, (https://learn.microsoft.com/en-us/azure/azure-sql/database/features-comparison?view=azuresql) it says that

System catalog views Some - see individual views

meaning that some views are missing. i'm assuming those dm_os_... views are some that were left out for some reason.