ASP.NET Compilation and other files don't mix

I love working in software. Mostly things work as expected, but at times no. I changed A, how can Z be affected - after all they are all miles apart. Right? Wrong. Z can be affected. Today’s story is the latest - totally unexpected, but not surprising.


We run ASP.NET compilation on our code base as part of every build in our Continuous Integration (CI) pipeline. I changed some part of the pipeline so that we started caching node_modules directory between different parts of a pipeline. So basically, .NET project A which did not have node_modules directory when ASP.NET compilation was being run earlier now has a node_modules directory.


The ASP.NET compilation was failing with an error:

Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located.

Searching for it, I come across this StackOverflow post. The issue is that the ASP.NET compiler was trying to compile the JavaScript files as well.


This is a hack, not a solution. I removed the node_modules directory before running the ASP.NET compilation.