ClassLibrary Projects and App.config

In Visual Studio .NET 2003 if you want you unit tests to use an app config file you need to ensure a config file exists with the same path as your test assembly but ending with '.config'. Life has improved a bit with Visual Studio 2005 as it will automatically copy any 'App.config' file to the correct place even for ClassLibrary projects. You can achieve the same affect in VS2003 by using the following post-build event:

copy "$(ProjectDir)App.config" "$(TargetPath).config"
Published Wednesday, June 07, 2006 11:04 PM by Jamie Cansdale
Filed under: , ,

Comments

# re: ClassLibrary Projects and App.config

i've heard that vb.net 2003 does not support post build events, how are they using such hacks for testdriven?

Tuesday, August 08, 2006 6:33 AM by jokiz

# re: ClassLibrary Projects and App.config

Thanks! Exactly what I needed. I only have one suggestion; quote your first param in case the path has a space in it. xcopy "$(ProjectDir)$(TargetFileName).config" /YR

Tuesday, October 03, 2006 12:02 PM by JB

# TestDriven.net, Nunit y los archivos de configuración.

Para especificar archivo de configuración a usar en los test de Nunit: 1 - Menú Project/Edit... 2 - En

Thursday, October 11, 2007 8:06 AM by Bits & Bread

# TestDriven.net, Nunit y los archivos de configuración. « Memoria Paginada

Pingback from  TestDriven.net, Nunit y los archivos de configuración. « Memoria Paginada

# re: ClassLibrary Projects and App.config

Thanks it resolved our issue.

Tuesday, October 14, 2008 11:37 PM by Alex

Leave a Comment

(required) 
(required) 
(optional)
(required)