I'm starting from the asp.net core with angular template for visual studio. This sets up a single angular app in the ClientApp directory and handles serving the angular app from npm during development and routing requests to the dist directory when deployed.
It works correctly with the single angular app, however, when I add a second angular app and attempt to duplicate the relevant sections of the csproj for the second app, visual studio seems to lose track of where the tsconfig files are (or something else perhaps...) and neither angular app will build and I get many typescript errors for both apps.
The relevant lines (as far as I understand) are:
<PropertyGroup>
...
<SpaRoot>testApp\</SpaRoot>
<Spa2Root>SecondApp\</Spa2Root>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**;$(Spa2Root)node_modules\**
</DefaultItemExcludes>
</PropertyGroup>
...
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="$(Spa2Root)**" />
<None Remove="$(Spa2Root)**" />
<None Include="$(Spa2Root)**" Exclude="$(Spa2Root)node_modules\**" />
</ItemGroup>
...
There are other lines which reference "Spa2Root" but they dont seem to affect the outcome.
If I simply remove the second "ItemGroup" all is well once again and the app serves correctly in development and publish mostly works. The issue is that I get all the config json files from "SecondApp" copied to the published directory (because the second item group takes care of making sure they dont end up there).
This obviously isnt the end of the world, but its also not correct and I'm wondering what I'm missing here.