Groups | Blog | Home
all groups > dotnet windows forms > february 2004 >

dotnet windows forms : Programmatically obtain the name of the assembly


Mike in Paradise
2/5/2004 9:36:06 AM
Tim Wilson
2/5/2004 12:32:48 PM
This should work:
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name

--
Tim Wilson
..Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}

[quoted text, click to view]

Patrick Steele [MVP]
2/5/2004 12:44:23 PM
In article <ONP5GrA7DHA.3648@TK2MSFTNGP11.phx.gbl>,
jbradshaw@blueyonder.co.yk says...
[quoted text, click to view]

Instead of the "FullName" property, try the "GetName" method. It
returns an AssemblyName object that should have all of those pieces
already parsed out.

--
Patrick Steele
Microsoft .NET MVP
JezB
2/5/2004 5:08:25 PM
How can I programatically obtain the name of the assembly that the code is
executing in ?

I've tried
System.Reflection.Assembly.GetExecutingAssembly().FullName
but this returns something like
"WorkPlace.Presentation.CommonLib, Version=1.0.1496.30348,
Culture=neutral, PublicKeyToken=null"
whereas what I'm after is just the "WorkPlace.Presentation.CommonLib" part.
Of course I could read up to the first comma but I'd like something cleaner.

I need this path to plug into a resource file name that I want to scan which
is embedded into my project :-

// TODO: How can I get the first part of this programmatically?
string ResFile =
string.Format("WorkPlace.Presentation.CommonLib.Messages_{0}",groupID);
ResourceManager rm = new
ResourceManager(ResFile,System.Reflection.Assembly.GetExecutingAssembly().);
ResourceSet rs =
rm.GetResourceSet(System.Threading.Thread.CurrentThread.CurrentUICulture,tru
e,true);
IDictionaryEnumerator id = rs.GetEnumerator();
// etc

hirf-spam-me-here NO[at]SPAM gmx.at
2/5/2004 7:04:35 PM
* "JezB" <jbradshaw@blueyonder.co.yk> scripsit:
[quoted text, click to view]

\\\
MsgBox(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name)
///

--
Herfried K. Wagner [MVP]
JezB
2/9/2004 9:54:22 AM
Thanks guys ...

[quoted text, click to view]

AddThis Social Bookmark Button