Current xaml path


How to access the path of the xaml being executed.
the Environment.CurrentDirectory gives the current execution base path.
But i need the path tof the xaml being executed.


Do you need the path of XAML in run time or Do you need to know where XAML is saved while developing?


I neeed the path during runtime.


@badita @alex.stoian
I am still stuck at this :worried:


Could you please explain your use-case? Why you need the path and what you are trying to achieve? Maybe we find an workaround.

Not straightforward (requires a bit of coding) but…you start in Environment.GetCurrentDirectory with Main.xaml, let’s say. Any path change will require an Invoke Workflow (wfPath). Therefore by concatenating the currentDirectory with wfPath - use Path.Combine - you’ll be able to get the current physical location of the running xaml.


Hi @akhi_s27,

Can you try using “system.appdomain.currentdomain.BaseDirectory”

This will give you the path of the xaml.




For me System.Appdomain.Currentdomain.BaseDirectory returns the installation folder of UiPath: C:\Program Files (x86)\UiPath Studio\ !?


Ah Ok.

I used another one CurDir and it seems to be working, Please check and confirm?




Try to use: System.IO.Directory.GetCurrentDirectory

It will return the full path of the XAML Directory :wink:



Just as a sidenote - Environment.CurrentDirectory (property) actually calls Directory.GetCurrentDirectory for Get, and Directory.SetCurrentDirectory for Set operation.

It’s quite an interesting situation actually :slight_smile: Either way, both will return same value and should work for this use case.