New to X# and need some direction

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
tom@dieselworks.com.au

New to X# and need some direction

Post by tom@dieselworks.com.au »

Isn't it right? I think XIDE did it itself, I just browsed for it
Attachments
JSon.JPG
JSon.JPG (42.34 KiB) Viewed 454 times
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

New to X# and need some direction

Post by wriedmann »

Hi Tom,

it could be that your system has one version of the library in the GAC, and the MYOB library needs a newer one.

With NuGet this works automatically.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

New to X# and need some direction - the XIDE Error

Post by lumberjack »

Hi Tom,
tom@dieselworks.com.au wrote: the only issue I have is that I have no idea what to copy where? I have located two folders in the project that I have set up in C# / Vs and copied them over into a new folder under the XIDE test project. Then I set up the references.

Both of these, the MYOB and JSON has a number of subfolders and to be honest I have no clue what to do here. I have copied the v4.0 folder of the JSon DLL into the v4.0 version of MYOB SDK but I still have the message
I think you need to copy the whole folder structure from VS not only the Assemblies. You do not need to add a Reference to NewtonJSON. MYOB will handle that part.

Look again at your error message, it tells you exactly what it needs, V7 of NwtonJSON. Problem is MYOB is looking for it in the same relative path as in your VS folder structure or you need the V7 JSON in the same folder as the MYOB assembly.

Code: Select all

System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
HTH,
______________________
Johan Nel
Boshof, South Africa
tom@dieselworks.com.au

New to X# and need some direction

Post by tom@dieselworks.com.au »

Thanks Wolfgang but I have fetched both using the VS NuGet - Command Line. what concerns me is that I have the code compiled and running it VS C# but that gets stuck half way through - while the XIDE will not even compile - same libraries
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

New to X# and need some direction

Post by robert »

Tom,
If a C# or X# project in VS uses NuGet then usually the necessary packages are copied to a packages subfolder in the solution.
The source for these packages is in the folder users<Currentuser>.nugetPackages
That last folder will have all versions of packages you have ever used. The packages folder in the solution will only have the package versions that are used in the solution.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

New to X# and need some direction

Post by wriedmann »

Hi Tom,

I have now tried to build a VS project. After building and running it, I had the follwing files in my bin folder:
myob_lib.png
myob_lib.png (5.58 KiB) Viewed 454 times
You should add exactly these DLL as references to your XIDE project.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
tom@dieselworks.com.au

New to X# and need some direction

Post by tom@dieselworks.com.au »

Thanks Robert, that is what I have found following your note. So what do I do with it? I can see 2 versions, 7.0.1 and 11.0.2
Attachments
nuget.JPG
nuget.JPG (18.97 KiB) Viewed 454 times
nuget_json_7.0.1.JPG
nuget_json_7.0.1.JPG (22.9 KiB) Viewed 454 times
tom@dieselworks.com.au

New to X# and need some direction

Post by tom@dieselworks.com.au »

Thanks Wolgang, what is the rule? Which one do I add? I can see a few versions
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

New to X# and need some direction

Post by wriedmann »

Hi Tom,

I have now tried to build a Console application in X# Core, with the following references (taken from the VS solution bindebug folder):
myob_xsharp.png
myob_xsharp.png (4.88 KiB) Viewed 454 times
The following X# code compiles for me:

Code: Select all

using System.Linq
using MYOB.AccountRight.SDK
using MYOB.AccountRight.SDK.Services
using MYOB.AccountRight.SDK.Services.GeneralLedger

function TestMYOB() as void
	
var configuration := ApiConfiguration{"http://localhost:8080/accountright"}
var cfService := CompanyFileService{configuration}
var companyFiles := cfService.GetRange()

//Next step in the flow is to select a company file that supports v2 contracts
// for the AccountRight API - anything from 2013.3 and up will do here.
var companyFile := companyFiles.FirstOrDefault( { x => Version{ x:ProductVersion } >= Version{"2013.3"} } )

//The company file credentials are an AccountRight requirement with the SDK providing the
//CompanyFileCredentials class to encapsulate these. For our example the company file
//login details in use are username: Administrator with no password on the admin account.
var credentials := CompanyFileCredentials{"Administrator",""}

//Now you are ready to start accessing resources directly from the API
var accountService := AccountService{configuration}
//var accounts := accountService.GetRange(companyFile,null,credentials)

return
The last line does not compile because I don't have the variable companyFile in my code.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

New to X# and need some direction

Post by wriedmann »

Hi Tom,

the rule is simple: you need to use what the MYOB people used to build their assembly.

You can look also with . NET Reflector or ILSpy to see what version is needed.
references.png
references.png (10.03 KiB) Viewed 454 times
The NuGet should retrieve the right DLL.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply