C# 重用现有的应用程序配置
如何重用现有应用程序的应用程序配置? 假设应用程序配置位于可供所有人访问的网络的公共存储库中 我发现了这个片段:C# 重用现有的应用程序配置,c#,.net-2.0,C#,.net 2.0,如何重用现有应用程序的应用程序配置? 假设应用程序配置位于可供所有人访问的网络的公共存储库中 我发现了这个片段: System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(strConfigPath); //Path to your config file System.Configuration.Configuration configuration = System.Configurati
System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(strConfigPath); //Path to your config file
System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
但是我在我的应用程序中遇到了这个错误,我正在使用。NET2.0
命名空间“System.Configuration”中不存在类型或命名空间名称“ConfigurationFileMap”(是否缺少程序集引用?)
命名空间“System.Configuration”中不存在类型或命名空间名称“Configuration”(是否缺少程序集引用?)
我应该如何执行此操作?默认情况下,App.config嵌入到程序集中。我建议的一个选项是将共享app.config添加为链接项,Project->add Existing item->\shared\app.config->(添加旁边的小箭头)->add as link
这基本上是一个到实际文件的快捷方式。您是否尝试添加对System.Configuration.dll的引用?我认为注释还应该有一个接受按钮…添加引用是否有帮助?如果这对你有帮助的话,你可以随时投票发表评论!