在库项目净的app.config项目、app、config

由网友(官方爸爸)分享简介:我有一个解决方案控制台应用程序项目和库项目(DLL)。图书馆项目app.config文件在哪里存储连接字符串的数据库。控制台应用程序引用这个DLL。 I have a console application project and library project (dll) in one solution. Th...

我有一个解决方案控制台应用程序项目和库项目(DLL)。图书馆项目app.config文件在哪里存储连接字符串的数据库。 控制台应用程序引用这个DLL。

I have a console application project and library project (dll) in one solution. The library project has app.config file where I store a connection string to database. The console application references this dll.

当我编译控制台应用程序,并与我不能够访问属于该dll,当我需要更改连接字符串的应用程序部署后app.config文件库中部署它。

When I compile the console application and deploy it with the library I am not able to access the app.config file that belongs the dll when I need to change the connection string after the application is deployed.

这是我看到这些文件,但不config文件:

This are the files that I see, but not .config file:

library.dll library.pdb console.application console.exe console.exe.manifest console.pdb console.vshost.application console.vshest.exe

我上哪儿去了?

推荐答案

在默认情况下,只有1的.config文件正在运行的应用程序。这是启动该程序的EXE文件关联的.config文件。你或许应该从DLL的配置文件到控制台应用程序的配置文件复制配置值。如果你真的想要让他们分开,那么你不能使用默认ConfigurationSettings.AppSettings字典。请参见这个问题获取更多的信息。

By default, there is only 1 ".config" file for a running application. It is the ".config" file associated with the EXE that started the program. You should probably copy the config values from the DLL's config file into the console app's config file. If you really want to keep them separate then you can't use the default ConfigurationSettings.AppSettings dictionary. See this question for more info.

阅读全文

相关推荐

最新文章