To debug msbuild build failures, you can run following from VS command prompt to get more build log output
msbuild /v:diag <solutionname>
If you want to log messages for debug during build, you can use Message tasks. For example, use Message task inside a target
<Message Text="Project File Name = $(MSBuildProjectFile)" />
<Message Text="Project Extension = $(MSBuildProjectExtension)" />
If you are doing build in VS2010 IDE, you can follow these steps to turn on verbose building to help debug msbuild issues.
- Open Visual Studio and go into the Tools->Options menu
- Go to Projects and Solutions->Build and Run and set MSBuild project build output verbosity to Diagnostic.
- Rebuild your project and now the output will show you all the environment variables and parameters.