RE: App.Config: using doctype and entity blocks



You might want to look at the Application Block Framework for .NET, which
gives examples on how to read or write, manipulate, the XML App.config from
within code. There are plenty of examples that come with the Application
Block Framework, which is free for download. The examples show you how to
set up sections in the App.Config for your usage and shows the code that will
do the manipulation of the App.Config. The Net 2003 version is standalone
and all you really do is reference the the DLL to use. The Application Block
Framework for the manipulation of the App.Config is included as part of the
2.0 Framework. You still can download the 2.0 Framework examples.

Duane :)

"Harold Howe" wrote:


When .NET loads an app.config at runtime (myapp.exe.config), will it
honor an entity declaration? Based on what I am seeing, the answer is
no, but I think, or hope, that I am doing something wrong.

I tried this:

// myapp.exe.config
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE configuration [
<!ENTITY mydll SYSTEM "mydll.xml">
]>

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
&mydll;
</assemblyBinding>
</runtime>
</configuration>

//mydll.xml
<dependentAssembly>
<assemblyIdentity name="mydll"
publicKeyToken="cbbe122047afc212"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.9999.9999.9999"
newVersion="1.0.4.0"/>
</dependentAssembly>

I verified that I have everything formatted correctly by loading the
config file into internet explorer (after changing the file extention to
..xml). IE processes the entity include just fine, but when I run my app,
fuslogvw reports that the XML config file is not formatted correctly.

LOG: This bind starts in default load context.
ERR: There was an error parsing XML (hr = 0xc00ce565).
WRN: Error parsing XML file N:\MyApp\bin\Debug\MyApp.exe.config. Ignoring.

I am trying to use an xml entity to include a separate config file with
a collection of binding redirects and codebase statements. Why am I
doing that? It is a long a sordid tale... But if there is another way to
import, merge, or share a config file, I would be open to it.

H^2

.



Relevant Pages

  • Re: How to verify CA for a X.509 certificate
    ... There has been a lot of work done around X509 for the 2.0 release of the framework. ... Both XML Encryption and XML Digital Signatures have ... >>> The article DOES check if the public key is in the store, ... >>> to use it to explicitly verify the signature on the cert. ...
    (microsoft.public.dotnet.security)
  • Re: Starting up application from dll.
    ... > The config file gets its name from the .EXE, ... > their settings from the config file for the EXE. ... > differently for each application that uses the DLL. ... then you can create an XML file that the DLLs will use. ...
    (microsoft.public.dotnet.framework)
  • RE: .net framework version, visual studio 03
    ... You can use a config file to direct the runtime to use a particular version ... framework using an older version of VB.net, ... I think you only have to switch one reference for each project, ... When compiling the release, I did the switch. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Open Project
    ... A light generic framework for php developers, built API style with a public interface and a private interface. ... PDO/Doctrine + contrib to doctrine project as well OR custom ORM built on top of PDO. ... Object to XML and XML to Object support, aim to add __toXMLfor all classes. ...
    (php.general)
  • RE: [PHP] Re: Open Project
    ... opensource and in PHP. ... framework, orm, webservice or basically anything without an html ... ORM built on top of PDO. ... Generic XML Parser using DOM API ...
    (php.general)