I have a .net core 3.1 Azure Function which is using the latest version of NHApi (3.0.4). The following lines of code throws an exception when running locally:
var pipeParser = new PipeParser();
var messageObject = pipeParser.Parse(messageString);
The exception is the following:
The type initializer for 'NHapi.Base.PackageManager' threw an exception. NHapi.Base: The type initializer for 'NHapi.Base.PackageManager' threw an exception. NHapi.Base: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Looking at my build folder in bin\Debug\netcoreapp3.1, i can see a System.Configuration.ConfigurationManager.dll. However i need to copy this file to bin\Debug\netcoreapp3.1\bin for the error to go away. It seems that this assembly doesn't get copied to the \bin subfolder (which contains all the other referenced assmblies) by default. Does someone know why this is the case? Short of adding some post build step to do this file copy, what's the solution ?