I am using electron-edge-js to call a C# DLL.
Within the DLL, the App.config file is called out for server connection information.
return (ServiceDetailConfiguration)ConfigurationManager.GetSection(ServiceDetailConfiguration.ServiceDetailConfigurationConst);
In my js file calling the dll, I can successfully call out to the dll, and process information. That is, until I hit the above line, I get a null exception thrown as it can't find the app.config.
I've tried the below:
Load WCF app.config bindings in edge.js app
working with electron-edge-js for existing dll with app.config
Without much luck.
In my package.json file, the name is "firstelectronapp". When i build the file, I output it as "test.exe"
So i've attempted these files in the same root folder as the test.exe file with no luck:
Is there something I'm missing? I wrote a quick C# app with an app.config that calls the dll, and when stepping through it I can tell that's what the issue is.
The config file should be renamed electron.exe.config and placed in the same directory as electron.exe - i.e. node_modules\electron\dist
.
I just ran into this when needing to add a bindingRedirect. Putting it in the above file solved it.
Also, if you're using electron-builder for packaging the app, you can easily include the config file in the packaged application by adding it to the extraFiles collection in the build configuration, for instance:
"extraFiles": [
{
"from": "app.config",
"to": "my-electron-app-name.exe.config"
}
]