Home > Software engineering >  uld not load file or assembly 'Sage_SA.SDK
uld not load file or assembly 'Sage_SA.SDK

Time:11-22

My problem is very similar to the one described here: Could not load file or assembly 'Sage_SA.Work

However, the file/assembly that is supposedly unable to be loaded in my case is Sage_SA.SDK (and not Sage_SA.Work).

Just like in the other case, I downloaded the Sage 50 SDK (Simply Accounting) that has the C# example code to run, and the example code worked fine. I was able to connect to my local "company" (I have the 30-day trial version). I copied the SDK from that example project, along with the other dll's that are used in that project.

When I copy the code to connect to the database:


           if (SDKInstanceManager.Instance.OpenDatabase([required params here]))
           {
               SageUtility.InitializeAfterDatabaseOpen();
           }

I get the following exceotion message:

"Could not load file or assembly 'Sage_SA.SDK, Version=29.0.0.4, Culture=neutral, PublicKeyToken=17d2fa970cd68de9'. The system cannot find the file specified.":"Sage_SA.SDK, Version=29.0.0.4, Culture=neutral, PublicKeyToken=17d2fa970cd68de9"

What is weird is that this exception is thrown when I try to accessing SDKInstanceManager.Instance, however I have no problem access some of the properties in that SDKInstanceManager class (e.g.,: SDKInstanceManager.NUMBEROFBOOKS).

Anyone has thoughts about the possible source of the error, and how it can be fixed?

Thanks.

CodePudding user response:

For future readers with the same problem: in my case, the problem was that I had mistakenly created a .NET Core Application instead of a .NET Framework Application. After switching to .NET Framework, it worked fine!

  • Related