Where is ${basedir} located, using NLog?

Based on already provided answers and comments, the answer can be summed up for .NET application:

AppDomain.CurrentDomain.BaseDirectory

For Console or Windows Forms application, this directory is bin/debug while within Visual Studio. If application is deployed, the path will most probably be the executable path.

For Web applications (ASP.NET) this will be the Web application root directory.

Not seeing any files may be triggered by several causes that include: NLog configuration errors and not being able to write the target file. To expose these errors make sure that NLog.config (or Nlog configuration embedded within web.config or app.config) specifies an internal log file to output such errors:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      internalLogFile="C:\NLogError\NLog.log">

<!-- targets and rules come here -->

</nlog>

It depends also of the platform. For regular .Net projects it's indeed bin or bin/debug etc. (depending of your build settings)

For coreclr / aspnet5 it's the bin folder of your dnx runtime. That's still work in progress.


Another possibility for failure is that if you are using NLog.config, NLog can't find the config file. Set the file to Copy Always in your build and it will end up in your bin directory, so NLog can find it at runtime.

If you copy the NLog configuration info to your App.config, you won't have this problem.


${basedir} — Directory where the application runs, aka. AppDomain.BaseDirectory

I think, you will find this manual page helpful.