Search code examples
c#reflection.net-assembly

C# Get Startup Project's Assembly Name


Some background: I have a project which collects all the diagnostics (trace source) information from the other projects within my solution. I needed a way to get the main project name so that I could give the dump file a proper unique name.

The issue: I could not find a clear-cut answer on how to obtain the startup project's assembly name until I ran into this blog entry: http://weblog.west-wind.com/posts/2009/Jun/09/Getting-the-Apps-Startup-Assembly-in-WPF-Designer


Solution

  • To get the name of the startup project, use:

    string ProjectName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;