Using app.config with Interop Controls(将 app.config 与互操作控件一起使用)
问题描述
我有一个使用 app.config 的 .net 项目 (MySolution.Common).我在名为 MySolution.InteropCtrl 的 InteropUserControl 项目中使用项目 MySolution.Common.MySolution.InteropCtrl 嵌入到 VB6 项目中.当 MySolution.InteropCtrl 在 VB6 项目中时,它找不到 app.config 文件.InteropControl 中的所有内容都可以在 VB6 中使用,除了依赖于 app.config 文件中的信息的内容.我需要更改什么以便 MySolution.InteropCtrl 在 VB6 中可以看到 app.config 文件?
I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file. Everything in the InteropControl works in VB6 except for what depends on the information in the app.config file. What do I need to change so the MySolution.InteropCtrl can see the app.config file while in VB6?
推荐答案
我对此不是 100% 确定的.但我会排除一些可能性.首先,app.config 不是文件的正确名称.虽然它是您项目中的 app.config,但它会自动重命名为 binary.exe.config 或 binary.dll.config(取决于项目类型)其中 binary 是项目的名称.
I'm not 100% sure on this. But I'll throw out some possibilities. First of all, app.config is not the correct name for the file. While it is app.config in your project, it gets auto-renamed to binary.exe.config or binary.dll.config (depending on project type) where binary is the name of the project.
其次,我不能 100% 确定 dll.config 文件是否总是在应用程序加载时被 .NET 正确加载和读取.我不相信它会自动发生,并且如果它用于 dll,则必须进行额外的调用才能读取配置文件.如果您重命名配置文件以匹配您的 exe,那么它肯定会加载并可供您使用.
Secondly, I'm not 100% sure if dll.config files are always properly loaded and read by .NET when the application loads. I don't believe it happens automatically, and that there is an extra call you have to make to read the config file if its for the dll. If you reneame the config file to match your exe, then it will definitely load and be available to you.
这篇关于将 app.config 与互操作控件一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 app.config 与互操作控件一起使用
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 输入按键事件处理程序 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
