Debuging ASP.NET application with VS 2008 and relative filenames

B

blescouet

Hi all,
In an ASP.NET application, I'm using NHibernate with an external
configuration file, located in the project directory. In my code, the
name of this file is given to NHibernate without path (relative name).
While debuging (with VS development Web Server), it throws a
FileNotFoundException, trying to load the file from C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not
from project's base path.
My colleagues, with the same source, haven't any problem : the file is
loaded from the project path.
I suppose I have something different in the configuration of my VS, or
my computer. But what, and Where ? I haven't any idea.

B.L.
 
M

Mr. Arnold

blescouet said:
Hi all,
In an ASP.NET application, I'm using NHibernate with an external
configuration file, located in the project directory. In my code, the name
of this file is given to NHibernate without path (relative name). While
debuging (with VS development Web Server), it throws a
FileNotFoundException, trying to load the file from C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not from
project's base path.
My colleagues, with the same source, haven't any problem : the file is
loaded from the project path.
I suppose I have something different in the configuration of my VS, or my
computer. But what, and Where ? I haven't any idea.

In nine cases out of ten, that 'FileNotFoundException' usually means there
is a reference to a DLL, a DLL calling another DLL, and the called DLL is
not on the machine.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4101 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
M

Mr. Arnold

blescouet said:
Hi all,
In an ASP.NET application, I'm using NHibernate with an external
configuration file, located in the project directory. In my code, the name
of this file is given to NHibernate without path (relative name). While
debuging (with VS development Web Server), it throws a
FileNotFoundException, trying to load the file from C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE\ as the base path, not from
project's base path.
My colleagues, with the same source, haven't any problem : the file is
loaded from the project path.
I suppose I have something different in the configuration of my VS, or my
computer. But what, and Where ? I haven't any idea.

In nine cases out of ten, that 'FileNotFoundException' usually means there
is a reference to a DLL, a DLL calling another DLL, and the called DLL is
not on the machine.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4101 (20090525) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
B

blescouet

Mr. Arnold a écrit :
In nine cases out of ten, that 'FileNotFoundException' usually means
there is a reference to a DLL, a DLL calling another DLL, and the called
DLL is not on the machine.

So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.
 
B

blescouet

Mr. Arnold a écrit :
In nine cases out of ten, that 'FileNotFoundException' usually means
there is a reference to a DLL, a DLL calling another DLL, and the called
DLL is not on the machine.

So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.
 
J

Jack Jackson

Mr. Arnold a écrit :

So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.

My understanding is that when you run a project in the IDE, it does
not run from the project directory, but an internal VS directory. I
have never been able to find anything that points to the true location
of the project.
 
J

Jack Jackson

Mr. Arnold a écrit :

So I'm the tenth case ! It's not about loading assemblies. I have an XML
file containing the NHibernante configuration. This file is placed in
the project's directory. In my code, I'm passing the file name to
NHibernate ("NHibernate.config"). And somewhere in his code, NHibernate
uses this file name to create an XmlTextReader instance. Inspecting the
BaseUri property of this instance gives "C:\Program Files\Microsoft
Visual Studio 9.0\Common7\IDE\NHibernate.config" when I'm expecting
"<site base directory>\NHibernate.config".

B.L.

My understanding is that when you run a project in the IDE, it does
not run from the project directory, but an internal VS directory. I
have never been able to find anything that points to the true location
of the project.
 
A

Andrew Morton

blescouet said:
So I'm the tenth case ! It's not about loading assemblies. I have an
XML file containing the NHibernante configuration. This file is
placed in the project's directory. In my code, I'm passing the file
name to NHibernate ("NHibernate.config").

Have you tried passing it Server.MapPath("~/NHibernate.config")?

Andrew
 
A

Andrew Morton

blescouet said:
So I'm the tenth case ! It's not about loading assemblies. I have an
XML file containing the NHibernante configuration. This file is
placed in the project's directory. In my code, I'm passing the file
name to NHibernate ("NHibernate.config").

Have you tried passing it Server.MapPath("~/NHibernate.config")?

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top