How to Publish Projects With External Config File?


#1

Background:
Hello, I have a project which use config.txt (an external text file in JSON format to save settings per user, like where to save files etc).

This is my current folder:
My Project
> Main.xaml
> config.txt

The question is:
How to publish this so that config.txt is not included in the .nupkg (without Orchestrator)?

Code:
What I do was exactly like in this answer, but how to publish it?

Details:

  1. When I published the project to MyProjectxxxxx.nupkg, move the .nupkg and config.txt to another computer (same folder), change the config.txt content according to the other computer’s setting, and run the robot, the robot is reading the config.txt I used in the development computer. Even when I deleted the config.txt from user’s package folder, it doesn’t throw error so it seems like the config.txt was included when making the package.

The user computer folder:
Package>
> MyProjectxxxxx.nupkg
> config.txt (the content is different)

  1. When I publish by deleting the config.txt from the folder first then publishing it, then move it to user computer and add config.txt in the same folder, it doesn’t read either.

Any idea how to do this, without Orchestrator?


Save values in a Config file and extract them for later use
#2

Attached one sample of how this could be done.

Key is to not have it in the Project folder, but in a dynamic (but predictable) path, f.e. attached project uses
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), configsFolder, ConfigFileName)
Which in my case evaluates to
C:\Users\MyUserName\AppData\Local\UiPathProjectConfigs\sampleConfig.txt

ExternalConfigSample.zip (3.9 KB)

And a screenshot for those that dont like/cant download zips:


#3

Thank you for your kind advise, @andrzej.kniola.
Using it now in my project :slight_smile:


#4

Hi,
I’m in need to do Uipath project from where I have to start?
Thanks