Category Archives: MSBuild

Using the #warning Preprocessor Directive

Conditional compilation is powerful. One Preprocessor Directive that I like to use to remind myself of a particular condition is #warning. The #warning preprocessor directive will trigger a compilation warning with a specified message when it is hit. For example, … Continue reading

Posted in C#, MSBuild | Leave a comment

C# Suppress Compilation Warnings with #pragma or the SuppressMessage Attribute

Although one would hope that you wouldn’t have to do so very often, sometimes it is useful to explicitly disable code analysis warnings within your application. For example, you could suppress warnings around references to obsolete methods that must be … Continue reading

Posted in Attributes, C#, MSBuild, Visual Studio | Leave a comment

Log the Output from your MSBuild Tasks

In an automated build process, you always need logs as reference for troubleshooting because the task is scheduled and running under the context of a different user, so you won’t be able to see console output. If you use MSBuild … Continue reading

Posted in MSBuild | Leave a comment

Intellisense for MSBuild files

To “enable” Intellisense for MSBuild projects ending with the extension “msbuild”: 1)      1) Add this registry key (no line break in the key): [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\ {412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions]”msbuild”=dword:00000029 2)      Create a file called “test.msbuild” and then try to open it.  Choose “Select program … Continue reading

Posted in MSBuild, Visual Studio | Leave a comment