I've written some custom logger for my MSBuild process and it's working fine from the command line:
msbuild <project> /logger:mylogger.dll
the question now is how should I specify my custom logger in the .csproj file so that when I build from Visual Studio my custom logger is used the same way as I use it when running msbuild from the command line.
This is not possible. In MSBuild API, RegisterLogger has to be called before the build is started. You should not change build configuration while the build is already going. You might be able to hack this by creating custom MSBuild task that adds a new logger in the middle of the build, but that would create more problems than it solves, because logger configuration is per build engine, not per project, so when you add/remove loggers, all projects that are involved in the build are affected.