views:

36

answers:

1

The problem we are experiencing was noticed in msbuild. We have an executable in a task that is throwing a FileNotFoundException. This LoadData.exe uses NHibernate to initialize data, so there is an NHibernate.config file in the root of the project.

The properties on the config are set to Content/Copy Always. I can confirm that, on build, this config file is copied to the output directory.

In a console window, you can launch this executable from within the bin/debug directory, and it will work without an error. From outside of this directory, you get a FileNotFoundException on the config file.

The error indicates that the NHibernate.config is being loaded relative to where we are executing MSBUILD in the BUILD directory, and not the LoadData.exe directory. Why is that? Can't we make it absolute to the exe?

Is there a BuildAction setting for this?

+1  A: 

Change your code to load the file from the location of your assembly.

SLaks
Kurt Johnson