app.config appSettings文件属性绝对路径

问题描述 投票:0回答:1

在我的App.config文件中,我正在尝试引用一个不在项目中的文件,我已经读过绝对路径应该有效。但是,我无法让它发挥作用。

我的App.config:

<?xml version="1.0" encoding="utf-8"?>    
<configuration>
    ...
    <appSettings file="C:/configs/Secrets.config" />
</configuration>

然后在引用的文件中:

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
   <add key="Username" value="user" />
   <add key="Password" value="password" />
</appSettings>

但是,当我运行我的项目时,appSettings没有附加值。我究竟做错了什么?

app-config
1个回答
0
投票

隐藏的扩展名,文件名实际上是Sectrets.config.txt,因为我没有将其保存为配置文件

© www.soinside.com 2019 - 2024. All rights reserved.