Electron-Edge-JS App.config
Electron-Edge-JS App.config
我正在使用 electron-edge-js 调用 C# DLL。
在 DLL 中,调用 App.config 文件以获取服务器连接信息。
return (ServiceDetailConfiguration)ConfigurationManager.GetSection(ServiceDetailConfiguration.ServiceDetailConfigurationConst);
在我调用dll的js文件中,可以成功调用dll,并处理信息。也就是说,在我点击上面的行之前,我会抛出一个空异常,因为它找不到 app.config.
我试过以下方法:
Load WCF app.config bindings in edge.js app
working with electron-edge-js for existing dll with app.config
运气不好。
在我的 package.json 文件中,名称是 "firstelectronapp"。
当我构建文件时,我将其输出为 "test.exe"
所以我尝试将这些文件放在与 test.exe 文件相同的根文件夹中,但没有成功:
- first.exe.config
- firstelectronapp.exe.config
- test.exe.config
- node.exe.config
有什么我想念的吗?我用 app.config 编写了一个快速的 C# 应用程序来调用 dll,当逐步执行它时,我可以告诉这就是问题所在。
配置文件应重命名 electron.exe.config 并放在与 electron.exe 相同的目录中 - 即 node_modules\electron\dist
.
我只是在需要添加 bindingRedirect 时 运行 加入其中。把它放在上面的文件中就解决了。
此外,如果您使用 electron-builder 打包应用程序,则可以通过将配置文件添加到构建配置中的 extraFiles 集合中,轻松地将配置文件包含在打包的应用程序中,例如:
"extraFiles": [
{
"from": "app.config",
"to": "my-electron-app-name.exe.config"
}
]
我正在使用 electron-edge-js 调用 C# DLL。
在 DLL 中,调用 App.config 文件以获取服务器连接信息。
return (ServiceDetailConfiguration)ConfigurationManager.GetSection(ServiceDetailConfiguration.ServiceDetailConfigurationConst);
在我调用dll的js文件中,可以成功调用dll,并处理信息。也就是说,在我点击上面的行之前,我会抛出一个空异常,因为它找不到 app.config.
我试过以下方法:
Load WCF app.config bindings in edge.js app
working with electron-edge-js for existing dll with app.config
运气不好。
在我的 package.json 文件中,名称是 "firstelectronapp"。 当我构建文件时,我将其输出为 "test.exe"
所以我尝试将这些文件放在与 test.exe 文件相同的根文件夹中,但没有成功:
- first.exe.config
- firstelectronapp.exe.config
- test.exe.config
- node.exe.config
有什么我想念的吗?我用 app.config 编写了一个快速的 C# 应用程序来调用 dll,当逐步执行它时,我可以告诉这就是问题所在。
配置文件应重命名 electron.exe.config 并放在与 electron.exe 相同的目录中 - 即 node_modules\electron\dist
.
我只是在需要添加 bindingRedirect 时 运行 加入其中。把它放在上面的文件中就解决了。
此外,如果您使用 electron-builder 打包应用程序,则可以通过将配置文件添加到构建配置中的 extraFiles 集合中,轻松地将配置文件包含在打包的应用程序中,例如:
"extraFiles": [
{
"from": "app.config",
"to": "my-electron-app-name.exe.config"
}
]