13

My database projects in Visual Studio have recently starting throwing these unresolved reference errors every time any create table file in the project is touched.

SQL71501: Column: ___ has an unresolved reference to Built-in Type [int].
SQL71501: Column: ___ has an unresolved reference to Built-in Type [datetime].
SQL71501: Column: ___ has an unresolved reference to Built-in Type [varchar].

If I rebuild the project, everything builds with no errors, and the errors flagged by Visual Studio disappear. However, as soon as I edit any file (even as little as adding a space to the end of a file), that file will immediately become plagued with these unresolved reference errors... until I rebuild again. However, as it's a fairly large project, I don't want to spend about a minute rebuilding after every single minor edit.

This project is worked on by several other people, who do not encounter this issue. How can I resolve this?


Update: If I change tabs, the errors for the first tab disappear until I go back to it. I've also disabled all extensions, but the problem still occurs.

5
  • Does your views/SPs reference the tables using this naming convention ( 3 parts qualified name ) ? 'DatabaseName.SchemaName.TableName' Commented Jan 14, 2016 at 12:40
  • Sorry, didn't clarify it correctly - it's the create table scripts specifically that do it. Those are written create table [schema].[table] ( ... ) Commented Jan 14, 2016 at 13:20
  • 3
    This is just an educated guess , please check the custom type's file properties in VS and make sure Build Action is set to Build. Commented Jan 14, 2016 at 17:37
  • @DeJaVo, thank you! That was the fix for me. Never would have thought of that as something to check. Commented Sep 29, 2018 at 19:35
  • my issue was I tried opening a visual studio 2022 solution file in visual studio 2019 Commented Aug 8, 2024 at 14:44

2 Answers 2

20

Close down Visual Studio, navigate to the project folder and find the .dbmdl file. Delete it. Reopen the project and rebuild it. This should solve the problem.

Sign up to request clarification or add additional context in comments.

3 Comments

The issue keeps coming back though. Hopefully one day we can track down the source of the corruption (multiple open VS instances perhaps?).
I'm having this issue recur sometimes multiple times a day, without using multiple VS instances. This is also after performing a full repair on VS. I'm using VS 2015.
Sadly, this had no discernible impact in my situation.
2

In my case the solution was to change the target of my SSDT project to a more recent version of SQL Server (right click on the projet/Properties/Project Settings/Target platform).

See: https://www.codeproject.com/Articles/565459/FixingplusSSDTplusunresolvedplusreferenceplustoplu

2 Comments

Just to add to this, to find out which version of SQL Server I was running, I ran SELECT @@VERSION against the database.
Thanks for this specification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.