'TextMeshPro can not be resolved as a class in visual studio

I start to use TextMesh Pro in unity3D 2018 to render text and it works well when I set it up in inspector. But by the time I try to reference it in the script in visual studio 2017, I find the vs always warn me there is no such a class. Could anyone give me a suggestion?



Solution 1:[1]

I'm not sure, but I think you need to use the namespace from text mesh pro "using TMPro" and variables look like this "public TextMeshProUGUI aTextMeshProField;"

Solution 2:[2]

I had the same issue, and none of the following worked for me: updating Visual Studio 2019 through Visual Studio Installer, updating to latest Unity LTS 2020.3 and the visual studio editor package on Unity Package Manager.

Then I saw there were issues reported years ago regarding namespaces and packages here, to I went to Unity > Edit > Preferences > External Tools and I unticked "Generate .csproj files for Registry Packages", and that did the trick for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lobsang White
Solution 2 Paulo Renan