cancel
Showing results for 
Search instead for 
Did you mean: 

AddonInstaller.NET Wizard and Screen Painter

Former Member
0 Kudos

Hi all,

I am using the AddonInstaller.NET Wizard to make *.ard but an *.srf form cannot be loaded.

I have done the following:

- In load the form with the following

' Form load and creation

oXmlDoc.load(".\..\PM_Algorithm.srf")

- In AddonInstaller.NET Wizard in Step: "Addon needed files" I add files and in "Extra 1" tab I put with browse the above *.srf file. I DO NOT put anything in "Destination Directory" (However I find after running in "Addon Files" directory *.srf).

Any Idea?

Notes:

- *.ard is normaly loaded to SAP B1

- Other services of this Addon work fine

- when I try to load the form form menu the system message is "Addon is disconnected"

Any Idea?

Thanks in Advance

Vangelis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think the reason the production version of your add-on can't find the .srf file is because of the relative path naming "..\..\" that you are using. In debug mode, your SRF file is perhaps in the bin directory which could be two layers deep in the relative path whereas when it's installed in 'sap\b1\addons\your directory', it's at the same level compared to your executable. Try moving the .srf file in your project to a directory that matches the relative path structure as when the addon is actually running.

Former Member
0 Kudos

John,

I moved the *.srf to 'sap\b1\addons\your directory' but no luck (with the same path).

Any idea?

Vangelis

Former Member
0 Kudos

John,

how should I code *.srf in order to be identified in 'sap\b1\addons\your directory' ?

Is it oXmlDoc.load("PM_Algorithm.srf")?

Please advice,

Best Regards

Former Member
0 Kudos

I want to be sure I understand your problem correctly. Your user-defined form, that is contained in a .srf file loads correctly when you are in debug mode, but when you register your addon and then try to run your code from inside the client (as your users do) then b1 cannot find your form to load, correct?

If that is true, then the following probably applies to you:

When the addon is successfully installed, your .srf & your executable should be in the same folder on the PC, PLACED THERE BY BUSINESS ONE.

Then when your addon loads the .srf by your line of code that says oXmlDoc.load("PM_Algorithm.srf"), I think that will work.

The only thing is then it won't work for debug mode, unless you copy the .srf into the same directory (probably bin/debug) that your debug executable runs from. That all depends on where you store your .srf while developing it.

When your load statement contained the ..\..\, you're telling the program to go up two directory levels to find the file, from the starting directory (which will be where your executable is stored). While developing that would work if your .srf was up at the same level as the solution file (when your executable is in bin/debug). But when your .srf is in the same folder as your executable (as it is when the addon is installed), then two folders up the path will not contain your .srf and the load would fail.

Edited by: John Chadwick on Oct 20, 2008 3:28 PM

Nussi
Active Contributor
0 Kudos

Hi,

i load it always that way in c#


string sPath = System.IO.Directory.GetParent(Application.ExecutablePath).ToString();
oXmlDoc.Load(sPath + "\\" + FileName);

FileName is the Filename of your ScreenPainter file

lg David

Former Member
0 Kudos

David,

in that case the physical location of file (*.srf) is:

C:\Program Files\SAP\SAP Business One\AddOns\my addon root directory' ?

Thanks,

Vangelis

Nussi
Active Contributor
0 Kudos

Hi,

exactly - the code sample gets the path where your AddOn.exe is

lg David

Answers (1)

Answers (1)

Nussi
Active Contributor
0 Kudos

Hi Vangelis,

i did not get the point - when the file is in the addon directory after installing why should the error be in the Installer ?

when the addon disconnects something went wrong in your addon.

in c# i recommend you to implent try catch in your methods and at least the addon does not disconnect.

lg David

Former Member
0 Kudos

Hi David,

the addon when is running in debug mode in .NET is working perfect. I have also "Try Catch" in code. I assume that "disconnect" must be because the form is not loaded.

Do you believe that the steps that I follow especially for "Destination Directory" in Addon Installer and the location of files?

Thanks

Nussi
Active Contributor
0 Kudos

Hi Vangelis,

i took the "Installer" from SDK sample directory and improved it - so i have my own installer with sexy design

when the .srf is not in the addon directory copy it only for testing by hand in the directory.

ok, let's say the missing .srf is the problem, you should anyway develop your addon in a way where the

addon doesnt crash when something is missing. for example: just rename the .srf for one testing and

look where your addon make problems with debugging. i know, that's not your original problem but it anyway improves

your "quality"

lg David