我有一个名为Foo的C#.NET库,它生成一个Foo.dll文件。这也是通过一个config文件看起来像这样配置:从非托管C++配置.NET库
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Foo.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<applicationSettings>
<Foo.Properties.Settings>
<setting name="Server" serializeAs="String">
<value>localhost</value>
</setting>
</Foo.Properties.Settings>
</applicationSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
我想要做的就是通话功能在这个.NET库从非托管C++程序调用的酒吧,并能够从更改其配置非托管C++应用程序。我可以通过在Foo中将类/接口属性ComVisible设置为true来从Bar调用Foo函数。但是,我无法从非托管C++应用程序更改.config文件值 - 服务器始终是“localhost”。
是我想要做的 - 从非托管C++配置.NET库 - 甚至可能吗?
与此相反,dll确实有配置文件。例如,如果上例中给出的.NET库的使用者从非托管C++ exe更改为托管C#exe,则可以通过复制来更新共享库Foo.dll的Server。将Foo的值配置到Bar.exe.config中。因此,我的原始问题是:如果.NET消费者有可能更新.NET dll的配置文件,那么非托管C++使用者是否可以更新.NET dll的配置文件? – 2011-01-20 22:23:19
@GP:这是一个** EXE **的配置文件。 DLL本身没有配置文件。 .Net框架将从不**看`Foo.dll.config`。 – SLaks 2011-01-20 22:49:22