473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

App.Config: using doctype and entity blocks


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
Dec 14 '06 #1
1 3286
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
Dec 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter C. Chapin | last post by:
I have a need to include Greek letters in some of my XML documents (the documents contain astronomical information and many stars are named using Greek letters). Following some earlier postings on...
1
by: Ken Larson | last post by:
I have a question about using XSL to extract information from an SVG (XML) file that has a DOCTYPE/DTD declaration. I am able to do this successfully if I write my own SVG files without such a...
2
by: __PPS__ | last post by:
Hello everybody, I use xerces for cpp and I'm tring to adapt domprint for my own needs. What I cannot find how to do is how can I preserve certain enteties. For example, if domprint run without...
4
by: grs | last post by:
Can a class library have a app.config file. Reason for asking is that the microsoft application blocks all read from myApp.exe.config. How can you use the application blocks if you do not have an...
3
by: bgeci | last post by:
I have problem with Entity definition. ____________________________________________ my file "test.xml" ---- <?xml version="1.0" ?> <!DOCTYPE message > <message>&Ep;</message> ---- IE6 Error...
2
by: Mark | last post by:
Hi there, I have two xml files, one is a master file and the other is just a fragment of xml. Master xml file uses 'DOCTYPE' to define the other file as an entity. Then, the master uses entity...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
0
by: =?Utf-8?B?a3Nlbg==?= | last post by:
Hi, I would like to use DTD entity in web.config. For example Here is my DTD <?xml version="1.0" encoding="us-ascii" ?> <!ENTITY SessionTimeout "30" > In the Web.config Add the following...
1
by: basavaraj koti | last post by:
I need to show image using xslt Below provided in my xml and xslt. <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="../xyz.xsl"?> <Grade class="03"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.