Last post Feb 28, 2018 05:39 AM by Brando ZWZ
Feb 27, 2018 04:47 AM|AksharaThangam|LINK
I'm new to C#. Please help me with the following code
DTE dte = (DTE)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
Project project = dte.ActiveDocument.ProjectItem.ContainingProject;
But I get the error 'IServiceProvider' does not contain a definition for 'GlobalProvider' and no extension method 'GlobalProvider' accepting a first argument of type 'IServiceProvider'.
I could not figure out the reason for this error. Please let me know the cause of the error.
Feb 28, 2018 05:39 AM|Brando ZWZ|LINK
I guess you don't add the references:
I suggest you could try to add this namespace in your codes, then it will work well.
Details, you could refer to this: