TypeScript Build Errors When Publishing ASP.Net Web Project

I had TypeScript files building and running perfectly when I’d debug locally, but when I changed over to publish the project, I got build errors galore:

Cannot find module ___

TS6053 – File ___ not found

I had forgotten that I set up my TypeScript Build configuration for Debug, but I hadn’t changed anything for the Release configuration in Visual Studio.

Obviously, that would produce different build results, right? It was just a little mysterious to me until I noticed the configuration differences.

If you’re running into similar errors when building / publishing your project using the Release configuration, right-click your ASP.Net web project, go down to TypeScript Build, and make sure that your configuration settings are the same between Debug and Release. In particular, my “Module System” settings were different until I adjusted things.

TypeScript Configuration