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

Testing my DLL with NUnit.

P: n/a
I have a DLL that relies on an XML file (that's in the same folder as
the DLL) to read some startup information. When I test my DLL, it seems
like NUnit actually copies the DLL into some temp folder (where my XML
file obviously doesn't exist) and executes it there. Obviously the test
fails because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

Thanks
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Frank Rizzo wrote:
I have a DLL that relies on an XML file (that's in the same folder as
the DLL) to read some startup information. When I test my DLL, it seems
like NUnit actually copies the DLL into some temp folder (where my XML
file obviously doesn't exist) and executes it there. Obviously the test
fails because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

You should be able to set it in Property -> Common Properties -> Build
Events. Thanks

Nov 16 '05 #2

P: n/a
Jianwei Sun wrote:


Frank Rizzo wrote:
I have a DLL that relies on an XML file (that's in the same folder as
the DLL) to read some startup information. When I test my DLL, it
seems like NUnit actually copies the DLL into some temp folder (where
my XML file obviously doesn't exist) and executes it there. Obviously
the test fails because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

You should be able to set it in Property -> Common Properties -> Build
Events.

Remember, NUnit doesn't build your code, so this is useless.

Thanks

Nov 16 '05 #3

P: n/a
"Frank Rizzo" <no**@none.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
I have a DLL that relies on an XML file (that's in the same folder as the
DLL) to read some startup information. When I test my DLL, it seems like
NUnit actually copies the DLL into some temp folder (where my XML file
obviously doesn't exist) and executes it there. Obviously the test fails
because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?


It's not NUnit doing this, it's Visual Studio (or whatever you're using to
build the tests).

In the test project, right-click the Reference to your DLL, pick
"Properties" and change "Copy Local" to false.

You could also add a build event to copy the XML file.
Nov 16 '05 #4

P: n/a
Frank,

How do you get a path to the XML file at runtime?
AppDomain.CurrentDomain.BaseDirectory should return you the original path to
your assemblies.

NUnit performs so-called "shadow copying" of your assemblies to prevent
locking them in the original location. ASP.NET uses the same trick for the
same reason: it allows xcopy deployment of ASP.NET applications.

HTH,
Alexander Shirshov

"Frank Rizzo" <no**@none.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
I have a DLL that relies on an XML file (that's in the same folder as the
DLL) to read some startup information. When I test my DLL, it seems like
NUnit actually copies the DLL into some temp folder (where my XML file
obviously doesn't exist) and executes it there. Obviously the test fails
because the DLL can't find the XML file.

How can I force NUnit to execute the DLL in place?
Or is there any way to have it also copy my XML file to its temporary
directory?

Thanks

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.