Skip to content

Ignoring Folders During Compilation in a ASP.NET Core RC2 Project

ASP.NET Core RC2 – DNX is dead. Introducing the DotNet CLI

Until RC2 of ASP.NET Core, the responsibility for building a project was handled by DNX which has now been retired. This has been replaced by the .NET CLI. Part of the motivation for this is to have one tool fulfilling the roles of DNX, DNU and DNVM to try to make things less confusing for developers when they set up their environments.

Ignoring a Folder in .NET CLI Compilation

One of the quirks during the transition to the .NET CLI from DNX was my project failed to compile. This was due to a node package that didn’t support .NET Core. Luckily the fix is straightforward – but perhaps a little hidden to someone unfamiliar. Within your project.json in the buildOptions section a compile object can be added with a property called exclude. This is a list of folders to be ignored when compiling the project.

With this in place, the node_modules folder in the project is ignored and the code compiles successfully.


Published in.NET CoreC#

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.