2014-01-29

How to Debug Build Problems in Visual Studio

I had a problem with a project. Every time that I used the Build command in Visual Studio, it insisted on rebuilding the project. This was true even if I had just rebuilt it, and nothing had changed. I needed to debug why that was happening.

The default in Visual Studio is to only show a minimal amount of information about the build. However, you can change that. Go to Tool > Options > Projects and Solutions > Build and Run. Then change the MSBuild project build output verbosity from Minimal to Normal. The next time you build, it will report more information to the Output window, including why the build was failing to notice that nothing had changed.

In my case, I had a NLog configuration file, NLog.config, that was always being copied to the bin directory, which forced the rebuild. I selected the file in the Solution Explorer and went to the Properties window. I changed the Copy to Output Directory property from "Copy Always" to "Copy if newer". This caused my build problem to go away.

No comments :

Post a Comment