May 27, 2010 at 4:54 am
How do I get path of executing package?
Quite simply - I need a method of getting the path location of the current executing package, which I then wanted to assign to a variable.
I've tried several of the the following, but they dont return what I'm after.
Public Sub Main()
'
Dim AppPath As String
AppPath = Environment.CurrentDirectory()
'System.IO.Directory.GetCurrentDirectory() ' Produces same result as above
MsgBox(AppPath, MsgBoxStyle.OkOnly)
Dim AppPath2 As String
AppPath2 = AppDomain.CurrentDomain.BaseDirectory
'System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location())
MsgBox(AppPath2, MsgBoxStyle.OkOnly)
'
Dts.TaskResult = Dts.Results.Success
End Sub
if my package is located in C:\MyFolder, I wan't that returned to a variable.
The purpose of this is that I can then dynamically set the paths of any execute package tasks that reside in the same folder as the current package.
This would make my package(s) easily portable and not path dependant.
_____________________________________________________________________________MCITP: Business Intelligence Developer (2005)
June 1, 2010 at 9:42 am
I have found that the method you are using works if you are not executing the package in the BIDS environment. When I run it like that the CurrentFolder is alway Program Files\Mirosoft Visual Studio Version (8,9,10) it depends on whic BIDS\Common7\IDE.
When I run the the SSIS Execution utility it reports the correct folder that the package is running from.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply