I have a question regarding AppSettings in C#.
First I′ll describe my situation.
My solution consists of an executable program program.exe
and an assembly.dll
.
The program references the assembly and works with it. The assembly-project has application settings set up with the Visual Studio project settings manager. Now when I compile my solution in my assemblyin
elease
folder there is an assembly.dll.config
file which contains the settings I have set up earlier.
Now the thing I don′t understand : in my program-project where I reference the assembly.dll
I have checked CopyLocal=True
, but in my programin
elease
folder there is only the assembly.dll
but not the assembly.dll.config file BUT STILL the assembly.dll
knows the settings I have set up in the assembly-project application settings.
Now I have read several times that assemblies always access the settings of the executable program but the program has no corresponding settings, so why does the assembly know the correct settings when there is no assembly.dll.config
file present?
I assume the settings are compiled into the assembly at compiletime (of course), but then it makes no sense that in my assemblyin
elease folder there actually IS an assembly.dll.config file.
I tried copying this file into my programin
elease
folder where the assembly.dll
is copied to on build action, but the assembly.dll
just ignores if there is an assembly.dll.config
file present in the same folder. It always uses the settings from compiletime. I just don′t understand the use of the assembly.dll.config
file. Why is it created when it never has impact on the assembly.dll′s
behaviour ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…