Find Vb.net project execution path and get environmental variable value


 Dim aPath As String
 Dim aName As String

        aName = _
          System.Reflection.Assembly.GetExecutingAssembly. _
          GetModules()(0).FullyQualifiedName

       ' aName = C:\Cast\Source\ver 5.6\DialogCast.Net\bin\Debug\Cast_Component_Net.dll

        aPath = System.IO.Path.GetDirectoryName(aName)

       'aPath = C:\Cast\Source\ver 5.6\DialogCast.Net\bin\Debug
'
--------------------------------------------------------------

Public gstrWinDir As String

        gstrWinDir = Microsoft.VisualBasic.Interaction.Environ$("windir")

' gstrWinDir =  C:\WINDOWS

Comments

Popular posts from this blog

ContextSwitchDeadlock was detected

Visual Studio setup and deployment projects

Using SvcUtil.exe to generate the proxy class and config file