We have a requirement to find the current user control’s project name at design time. We used the EnvDTE to find the project name as
DTE dte = this.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
if (dte == null)
return null;
if (dte.ActiveDocument != null &&
dte.ActiveDocument.ActiveWindow != null &&
dte.ActiveDocument.ActiveWindow.Project != null)
{
Project currentProject = dte.ActiveDocument.ActiveWindow.Project;
return currentProject.Properties.Item(“AssemblyName”).Value;
}