I have an ASP.NET Core application with a corresponding Angular app. For convenience I host the Angular app as a part of the ASP.NET Core application.
So I have the Angular TypeScript files as part of my solution:
When I run the Angular build the output is copied to the wwwroot folder of the ASP.NET Core application:
However by including the TypeScript files as part of my solution Visual Studio tries to compile my Angular application when I run a build. In this case this is not what I want as it resulted in the following errors:
To fix it, I had to disable TypeScript compilaton. This can be done by adding the TypeScriptCompileBlocked
property to your project file and set this to True
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>net7.0</TargetFramework> | |
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> | |
<RootNamespace>VLM.eShopExample.Web</RootNamespace> | |
<IsPackable>false</IsPackable> | |
</PropertyGroup> | |
<PropertyGroup> | |
<Nullable>enable</Nullable> | |
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild> | |
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis> | |
<!--👇 Set this to true to disable TypeScript compilation--> | |
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> | |
</PropertyGroup> | |
</Project> |