我有 MVVM 应用程序,它通过 WCF 使用外部服务。
WCF客户端配置位于ViewModel的app.config中,这使得应用程序无法读取它,因为View是启动项目,因此应用程序使用View的配置文件。
除非我将 ViewModel 的配置文件复制到 View 配置文件中,否则它无法正确加载配置。
有没有办法将解决方案中的所有项目引用到一个通用配置文件?
最佳答案
您可以将配置文件添加到 View 或 ViewModel 项目,并通过将其添加为 link reference
来引用其他项目中的此配置文件。 .
Link file leaves the file in its current location and maintains a link to the file from your current project.
关于c# - MVVM 通用 app.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25837502/