Friday, March 25, 2022

The type or namespace name 'componentstate' could not be found (are you missing a using directive or an assembly reference?)

 The type or namespace name 'componentstate' could not be found (are you missing a using directive or an assembly reference?) 

Recently, I was using CrmSvcUtil.exe to generate early bound classes for the new trail Dynamic CRM instance created. When I used the generated class in Dynamic CRM, Visual Studio started complaining about various missing assembly references. 

I was using the latest CRM SDK libraries (NuGet Packages) for the newly created CRM Trail instance with the latest CrmSvcUtil downloaded. Still out of luck.



Solution:

I tried the XrmToolbox plugin – Early Bound Generator to generate files. 




Files would be generated as in the below path and when used in the project, it all worked.

C:\Users\Vipin\AppData\Roaming\MscrmTools\XrmToolBox\Settings\EBG