Opening session with C#/Libraries on 2025.2

Hi, we are in the process of migrating from 2022.2 to 2025.2 and converting all our external app code to use API calls. However, in the meantime, I would like to make our original custom code (using C# and Epicor libraries) to still work with 2025.2. I updated my VS solution with all the new DLLs but I seem to struggle creating a session now.

Original 2022 code was basically:

using (Session session = new Session(strUserName, strPassword, strAppServer, Session.LicenseType.Default, strConfigFile, true, strCompany))
{
}

but in 2025 “Session.LicenseType.Default” gives “Session’ does not contain a definition for ‘LicenseType’” compiling error so I tried to change it to this (which I’m not sure if correct):

using (Session session = new Session(strUserName, strPassword, strAppServer, new Guid(“00000003-B615-4300-957B-34956697F040”), strConfigFile, true, strCompany))
{
}

that line at execution returns the below:

Error at quote line 0: Exception has been thrown by the target of an invocation.:System.TypeInitializationException: The type initializer for ‘Ice.Api.Client.ProxyHttpClientFactory’ threw an exception. —> System.IO.FileLoadException: Could not load file or assembly ‘Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Ice.Api.Client.ProxyHttpClientFactory.CreateHttpClientFactory()
at Ice.Api.Client.ProxyHttpClientFactory..cctor()
— End of inner exception stack trace —
at Ice.Api.Client.ProxyHttpClientFactory.CreateClient(AuthenticationMode authenticationMode)
at Ice.Proxy.Lib.SessionModImpl..ctor(Uri baseAddress, String userId, String password, AuthenticationMode authenticationMode)

Any clue? Thanks in advance.

The error tells you exactly what the problem is the version of the DLL you have doesn’t match the definition it expects. You probably have an old DLL in your Visual Studio that snuck in somewhere.

Looks like it wants version 8 (I’m guiessing .net 8) and you probably have your project set to a different .net version.

I’m on .NET 4.8. I read that we need NET Framework 4.8 on the client side, .NET Core 8 on the server side. So if I write a little stand alone application that logs into Epicor using Epicor dll files, is that considered client or server side? Thanks

Depends on what files you are using. At the moment the error you shared is specifically looking for a version 8 file (I’m assuming .net 8 core)

It is specifically looking for verision 8 of this file:
Microsoft.Extensions.DependencyInjection.Abstractions

And the file it found is the wrong version.

Updating my project to .NET 8 Core solved it. Thanks!