For a Visual Studio projects such as a ASP.NET MVC5, how do you disable compiling of TypeScript files on build/debug?
I currently have tsconfig.json
compileOnSave
and buildOnSave
set to false. Does something need to be added to the projects .csproj
to ensure it isn't compiled?
When debugging the ASP.NET MVC5 project, it compiles all .ts
files.
Thank you for any help you can provide.
Fortunately, it's easy to disable automatic TypeScript compilation. Just add a “TypeScriptCompileBlocked” element to your project's xproj file and give it a value of “True”. This will prevent Visual Studio from making those pesky extra files.
It is possible to manually remove TypeScript support by editing the project file in notepad, but is there a GUI in VS that handles this? Side note: Why on Earth would you use Notepad when you have Visual Studio??? Just right-click | Unload Project , then right-click | Edit {project name here} .
This allows a project to build against the same versions of the compiler on different machines. If TypeScriptToolsVersion is not specified, the latest compiler version installed on the machine will be used to build.
right-click the project node and choose Manage NuGet Packages. In the Browse tab, search for Microsoft. TypeScript. MSBuild, and then click Install on the right to install the package.
Add the property <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
to a PropertyGroup in your csproj file (I added it under the Configuration label). This should disable all msbuild based TS compilation.
With this setting enabled you shouldn't need the tsconfig.json settings compileOnSave/buildOnSave.
If you are on an older version of Visual Studio (I had implicitly thought about VS 2017 or xproj with 2015), the property may be <TypeScriptEnabled>false</TypeScriptEnabled>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With