Get Folder Path of Project Using a Activity

I am getting the Folder Path of my Project in my workflow using “Environment.CurrentDirectory”. But when I created a activity out of the workflow “Environment.CurrentDirectory” gives me the path for the Nuget Package Library instead of the path for my project.

Anyone know what I can use as a substitute for “Environment.CurrentDirectory” to return the path of my project when using it as a activity?

Hi @Terry_Lars

yes environment.currentdirectory gives nuget packages folder since the project has been copied and moved to this folder when we publish

what i would is give the project folder path in an asset or excel or text file and read the folder path from the any one of the source

Hi @prasath_S

Is there any way other than adding it as a asset or as info inside a file? Maybe there is a function or property I can use.

No not from me @Terry_Lars as it is in completely another path , maybe if you know a common folder we can loop through the directories and check if the folder can be found.

Users can prevent libraries from changing the current directory by using a new constant value, UiPath.Constants.Project.Location, of type String. This constant returns the folder path where the project is executed from, similar to the System.Environment.CurrentDirectory constant.
The difference is when a UiPath library is invoked in the process, UiPath.Constants.Project.Location returns the path of the executing process, while Environment.CurrentDirectory is returning the location of the library when used inside the library or in a parallel scope with a library activity.
UiPath.Constants.Project.Location also acts as a feature flag: when used anywhere in a library, the current directory is not changed to the location of the library but kept to the location of the process. The fully qualified name of the constant as Namespace is required for the feature flag to work.

1 Like

@Terry_Lars

Use this Path to get your Project Path.

IO.Directory.GetCurrentDirectory

Regards.