Debuging ASP.NET application with VS 2008 and relative filenames

  • Thread starter Thread starter blescouet
  • Start date Start date
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.
 
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
 
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
 
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.
 
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.
 
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.
 
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.
 
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
 
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
 
Back
Top