By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

<include> with relative file path does not work

P: n/a
I am trying to <include> some text into an XML documentation topic, but
that text is stored in a file that is in a different directory than the
"current" XML file. Using a relative path does not appear to work, because
the base being used is the Common7\IDE directory, not my original source
directory.

Here is the situation:

MyApp directory contains the file Form1.cs, Form1.xml, and Generic.xml.
There is also a subdirectory called SubDir, which contains Form2.cs and
Form2.xml. In Form2.xml I want to <include> a topic from Generic.xml, like
this:

<Form2 name="Foo">
<include file='Generic.xml' path='Generic[@name="Bar"]/*' />
</Form2>

The above doesn't work, because when the overall MyApp.xml file is produced
it cannot find Generic.xml. The complaint generated by the compiler is as
follows:

c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\Generic.xml
Badly formed XML in included comments file -- 'The system cannot locate the
object specified.'

So I tried the following:

<include file='..\Generic.xml' path='Generic[@name="Bar"]/*' />

But this doesn't work either, because as the above message implies, the
Common7\IDE directory is being used as the base from which to calculate the
relative path. Here's the error:

c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Generic.xml
Badly formed XML in included comments file -- 'The system cannot locate the
object specified.'

As can be seen, instead of failing to find the file in the IDE directory it
now fails to find the file in the Common7 directory. But why is it looking
there instead of where my source code is?

Finally I tried hard-coding the path:

<include file='C:\Dev\MyApp\Generic.xml' path='Generic[@name="Bar"]/*' />

This worked, but it is unsatisfying because the XML files are now tied to a
particular directory location on my hard drive. A different developer on
the team might have their development tree elsewhere, and these path
references would fail to compile.

What I can't figure out is why the Common7\IDE directory is being used as
the base from which to resolve the relative paths. Is there a setting
somewhere in Visual Studio that controls this?

Regards,
Alex VanderWoude

Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 14 Nov 2003 16:27:58 -0700, Alex VanderWoude <al**@computronix.com>
wrote:
I am trying to <include> some text into an XML documentation topic, but
that text is stored in a file that is in a different directory than the
"current" XML file. Using a relative path does not appear to work,
because the base being used is the Common7\IDE directory, not my original
source directory.

Here is the situation:

MyApp directory contains the file Form1.cs, Form1.xml, and Generic.xml.
There is also a subdirectory called SubDir, which contains Form2.cs and
Form2.xml. In Form2.xml I want to <include> a topic from Generic.xml,
like this:

<Form2 name="Foo">
<include file='Generic.xml' path='Generic[@name="Bar"]/*' />
</Form2>

The above doesn't work, because when the overall MyApp.xml file is
produced it cannot find Generic.xml. The complaint generated by the
compiler is as follows:

c:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\Generic.xml Badly formed XML in included comments file --
'The system cannot locate the object specified.'

So I tried the following:

<include file='..\Generic.xml' path='Generic[@name="Bar"]/*' />

But this doesn't work either, because as the above message implies, the
Common7\IDE directory is being used as the base from which to calculate
the relative path. Here's the error:

c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Generic.xml
Badly formed XML in included comments file -- 'The system cannot locate
the object specified.'

As can be seen, instead of failing to find the file in the IDE directory
it now fails to find the file in the Common7 directory. But why is it
looking there instead of where my source code is?

Finally I tried hard-coding the path:

<include file='C:\Dev\MyApp\Generic.xml' path='Generic[@name="Bar"]/*' />

This worked, but it is unsatisfying because the XML files are now tied to
a particular directory location on my hard drive. A different developer
on the team might have their development tree elsewhere, and these path
references would fail to compile.

What I can't figure out is why the Common7\IDE directory is being used as
the base from which to resolve the relative paths. Is there a setting
somewhere in Visual Studio that controls this?

Well, I wasn't able to figure out how to make a reference work, so I solved
it by creating a Pre-Build action that copies the necessary files to the
same directory as the "calling" topic. Using the previous example, the
Pre-Build action copies the Generic.xml file to the SubDir subdirectory,
which allows the compiler to find the topic it's looking for while
compiling Form2 and include the relevant XML in the output file. Since the
file is copied every time a rebuild is issued, the copied file contains all
the latest text, and all is well.

Better than a poke in the eye, I suppose.

- Alex

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.