cancel
Showing results for 
Search instead for 
Did you mean: 

Having a configuration file working with add-on

Former Member
0 Kudos

Hi, does anyone have a configuration file working with their add-on. For some reason when I add a configuration file with some user settings and put it into the add-on folder the add-on crashes? Anyone got an idea?

Thanks

Sally

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks I ended up using a text file and reading it in line by line.

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

How do you read your config file from the add-on ?

Former Member
0 Kudos

well the normal way of reading a configuration file in vb is just having a configuration file which ends in the name of the executable and config

My vb program uses and executable but when i used the B1DE to create the add-on the config file dissapears (i think it must package it all up)

After that I attempted to put the configuration file back into the bin folder with the executable B1AddOnInstallerNET1.exe and i called it B1AddOnInstallerNET1.exe.config but when i run the add-on it fail.

Any ideas why?

Thanks

Sally

former_member184566
Active Contributor
0 Kudos

Hi

I have something similar. Once installing i have a text file with certain settings. By changing that certain things will be done by the add-on differently. So, it can be done. My add-on also creates a log file that writes error to this log file. It is in the add-on directory and has never gotten deleted.

Hope this helps

Former Member
0 Kudos

Hi Loius, thanks for that...have you created your add-on in visual basic? and how have you referenced your text file so that your executable can access the settings...is it a text file?

Thanks

Sally

former_member184566
Active Contributor
0 Kudos

Hi Sally

I use VB.Net. I use the following code to get the directory

Private AddOnDirectory As String = Nothing

AddOnDirectory = Environment.CurrentDirectory+ "\" + FileName + ".txt"

Then you just write or read to the. Here is sample code where I write to the file.

Dim WriteToFileStream As StreamWriter

Dim Path As String

Path = AddOnDirectory + "\" + FileName + ".txt"

WriteToFileStream = New StreamWriter(Path, True, System.Text.Encoding.Default)

WriteToFileStream.WriteLine("Hello")

Hope the above helps

Former Member
0 Kudos

I suppose its one way of doing it...I'm not sure if it will work in my case

I was hoping to be able to use a configuration file the usual way as i have already created it whilst developing my add-on in vb.net. It seems odd that when the add-on is packaged up it cannot access the configuration file the usual way. Maybe it's something SAP needs to consider.

If anyone else has managed to use a configuration file this way then please let me know...

Thanks

Sally