none
Locating the path in the environment variable for Visual Basic.net for compiling, runtime and debug RRS feed

  • Question

  • Hello,

    Briefly, I wanted to know where within the file hierarchy of Visual Basic.net would be for the path for compiling, runtime, and debugging?

    Its purpose is to set its path and update the system variables within the control panel dialog.

    If there are more than one file path, or if they are comprised of dynamic link libraries, then it would be a different story, of how and where to run them from more than one file path - especially from more than file level up.

    Regards,

    JohnDBCTX


    jp

    Wednesday, September 11, 2019 6:35 PM

All replies

  • Hello,

    You can use AppDomain.CurrentDomain.BaseDirectory for the path of the main executable at runtime. You can traverse folders in a solution via the following e.g. the first three methods.

    Imports System.IO
    
    Public Module Extensions
        Public Function CurrentProjectFolder() As String
            Return AppDomain.CurrentDomain.BaseDirectory.UpperFolder(3)
        End Function
        Public Function SolutionCurrentProjectFolder() As String
            Return AppDomain.CurrentDomain.BaseDirectory
        End Function
        Public Function SolutionFolder() As String
            Return AppDomain.CurrentDomain.BaseDirectory.UpperFolder(4)
        End Function
        <Runtime.CompilerServices.Extension>
        Public Function UpperFolder(FolderName As String, level As Integer) As String
            Dim TheList As New List(Of String)()
    
            Do While Not String.IsNullOrEmpty(FolderName)
                Dim temp = Directory.GetParent(FolderName)
                If temp Is Nothing Then
                    Exit Do
                End If
                FolderName = Directory.GetParent(FolderName).FullName
                TheList.Add(FolderName)
            Loop
    
            If TheList.Count > 0 AndAlso level > 0 Then
                If level - 1 <= TheList.Count - 1 Then
                    Return TheList(level - 1)
                Else
                    Return FolderName
                End If
            Else
                Return FolderName
            End If
        End Function
    
    End Module


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, September 11, 2019 7:55 PM
    Moderator
  • That's a start.  Okay, so among the selected executable filenames, for instance, if users were to compile or interpret Visual Basic apps from the command shell then, which command libraries with switches?

    Regards,

    JohnDBCTX


    jp

    Thursday, September 12, 2019 2:33 AM
  • That's a start.  Okay, so among the selected executable filenames, for instance, if users were to compile or interpret Visual Basic apps from the command shell then, which command libraries with switches?

    Regards,

    JohnDBCTX


    jp

    I can interpret your meaning of "which command libraries with switches?"

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange



    Thursday, September 12, 2019 2:39 AM
    Moderator