Which is equivalent to App.Path and App.EXEName in VB.Net

I need help to find the equivalent of App.Path and App.EXEName in VB.Net in a DLL.

Thank you for your help.

+5
source share
1 answer

According to MSDN ( Changes to Application Objects in Visual Basic.NET ), a replacement for both is

System.Reflection.Assembly.GetExecutingAssembly().Location

It contains the full path ( App.Path), as well as the file name ( App.EXEName). You can share information using helper methods from the class Path:

' Import System.Reflection and System.IO at the top of your class file
Dim location = Assembly.GetExecutingAssembly().Location
Dim appPath = Path.GetDirectoryName(location)       ' C:\Some\Directory
Dim appName = Path.GetFileName(location)            ' MyLibrary.DLL

UPDATE ( ): DLL , EXE DLL, GetEntryAssembly GetExecutingAssembly. , GetEntryAssembly Nothing, DLL EXE.

+11

All Articles