It becomes a nice exercise to ask a question and (because I need a Solution) answer it by myself (by searching a lot and reading a lot of articles)
Here it is the same ... but perhaps someone else in future needs this answer too ...
The Keyword is "DTE" - the "Development Tools Environment" for Visual Studio.
For this it is necessary to add "EnvDTE" to the references.
The 2nd Keyword is DesignTime - at Runtime the methods from my question above are working properly.
So ... here is the VB-Code :
Function GetBuildFolder() As String
Dim myDTE As DTE = Marshal.GetActiveObject("VisualStudio.DTE")
Dim myProj As EnvDTE.Project = myDTE.Solution.Projects(0)
Dim absoluteOutputPath As String
Dim projectFolder As String
Try
Dim configManager As EnvDTE.ConfigurationManager = myProj.ConfigurationManager
If configManager IsNot Nothing Then
Dim activeConfiguration As EnvDTE.Configuration = configManager.ActiveConfiguration
Dim outputPath As String = activeConfiguration.Properties.Item("OutputPath").Value.ToString()
If outputPath.StartsWith(IO.Path.DirectorySeparatorChar & IO.Path.DirectorySeparatorChar) Then
absoluteOutputPath = outputPath
ElseIf outputPath.Length >= 2 AndAlso outputPath.Chars(1) = IO.Path.VolumeSeparatorChar Then
absoluteOutputPath = outputPath
ElseIf outputPath.IndexOf("..\") <> -1 Then
projectFolder = IO.Path.GetDirectoryName(myProj.FullName)
Do While outputPath.StartsWith("..\")
outputPath = outputPath.Substring(3)
projectFolder = IO.Path.GetDirectoryName(projectFolder)
Loop
absoluteOutputPath = IO.Path.Combine(projectFolder, outputPath)
Else
projectFolder = IO.Path.GetDirectoryName(myProj.FullName)
absoluteOutputPath = IO.Path.Combine(projectFolder, outputPath)
End If
Return absoluteOutputPath
End If
Catch ex As Exception
End Try
Return ""
End Function