"XXX" does not contain a definition for "YYY"

Problem

Visual Studio keep teeling "XXX" does not contain a definition for "YYY", for instance:

  • "SPMeta2.Syntax.Default.SiteModel" does not contain a definition for "AddTaxonomyTermStore"

Explanation

M2 has lots of extension methods over various namespaces, and VS can do a better job on resolving these methods and namespaces. That's why sometimes the code can't be complied and VS does not suggest anything at all.

Solution

It can be suggested to find the correct namespace for the giving extension method an the use "using" construction to include the correct namespace.

Alternatively, ReSharper or other tooling like CodeRush can fix that - they suggest missing bits/methods/namespaces across solution much better that VS, using templates can help too or that would be just a matter of the learning curve, unfortunately.

Links

https://www.yammer.com/spmeta2feedback/#/Threads/show?threadId=589359209