Hello,
I'm having an issue with the latest NetServer core release, when I reference the NuGet package directly and use the following code to bootstrap netserver, it works fine:
var services = new ServiceCollection();
services
.AddNetServerCore()
.AddSoDatabase()
.AddSingleton<Microsoft.Extensions.Logging.ILogger, SuperOffice.Logging.SoLogger>()
.AddSingleton<SuperOffice.Security.Principal.IContextInitializer, ContextInitializer>();
var provider = services.BuildServiceProvider(true);
provider.RegisterWithNetServer();
But when I reference the exact same NetServere Core package (and related packages) in a class library, use the code above to bootstrap netserver, and load it from a different application using Assembly.LoadFrom, I get the following error on the 'RegisterWithNetServer' line
We have all NetServer related code in a seperate class library, which is per SuperOffice version and we load according to the SuperOffice database version we are connected to. (Yes all legacy/technical debt, but can't just rewrite it all to the webapi package) This used to work fine with previous releases of NetServer but now broke with the change in bootstrapping/initilization.
Based on other results when searching the forum here, I think it is related to a missing assembly/dll, but when I compare the dll's when referencing the nuget package directly or through our class library setup, they are the same.
Does anyone have a few pointers/direction to help debug this?
Alle Antworten (1)
Loading an assembly using Assembly.LoadFrom does not automatically load its dependency. You will have to implement an AssemblyResolver... There is an event you can hook into for that.
Hope this helps!