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?
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.