Find the Current UserControl’s Assembly Name?

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;

                         }

 

Advertisements

About ambilykk

I am a Technology Evangelist on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Azure and Visual Studio. Technology adoption and learning is my key strength and technology sharing is my passion.
This entry was posted in EnvDTE. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s