Msbuild dotnet构建未构建非npm SPA

Msbuild dotnet构建未构建非npm SPA,msbuild,single-page-application,elm,asp.net-core-3.1,Msbuild,Single Page Application,Elm,Asp.net Core 3.1,我目前正试图将一个单页应用程序集成到C#.Net Core 3.1项目中,但我正在努力说服MSBuild编译spa并将其捆绑到运行时可执行文件中 SPA使用Elm+创建Elm应用程序,因此不使用npm。我已经调整了.csproj文件,将其委托给elm app build,但没有调用它。故意破坏Elm代码以再次强制构建失败没有任何效果。请注意,我已经用elm东西替换了node_模块,依赖项等可以下载到elm东西。我认为这与我的项目组有关,但源文件在我的(Rider)项目浏览器中可以识别。还注意到

我目前正试图将一个单页应用程序集成到C#.Net Core 3.1项目中,但我正在努力说服MSBuild编译spa并将其捆绑到运行时可执行文件中

SPA使用Elm+创建Elm应用程序,因此不使用npm。我已经调整了.csproj文件,将其委托给
elm app build
,但没有调用它。故意破坏Elm代码以再次强制构建失败没有任何效果。请注意,我已经用elm东西替换了node_模块,依赖项等可以下载到elm东西。我认为这与我的项目组有关,但源文件在我的(Rider)项目浏览器中可以识别。还注意到

my.csproj中有趣的部分:

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <TargetFramework>netcoreapp3.1</TargetFramework>
        <IsPackable>false</IsPackable>
        <SpaRoot>ClientApp\</SpaRoot>
        <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)elm-stuff\**</DefaultItemExcludes>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="EventStore.ClientAPI.NetCore" Version="4.1.0.23" />
      <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.4" />
      <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.4" />
      <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.4" />
      <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.4" />
    </ItemGroup>

    <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)elm-stuff\**" />
    </ItemGroup>

    <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
        <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
        <Exec WorkingDirectory="$(SpaRoot)" Command="elm-app build" />

        <!-- Include the newly-built files in the publish output -->
        <ItemGroup>
            <DistFiles Include="$(SpaRoot)build\**" />
            <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
                <RelativePath>%(DistFiles.Identity)</RelativePath>
                <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
                <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
            </ResolvedFileToPublish>
        </ItemGroup>
    </Target>
</Project>
dotnet构建的结果显示成功编译了C#source,但未提及委托或未能委托给elm应用程序:

will@cafell Application % dotnet build                                                                     
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 49.73 ms for /Users/will/src/startups/ideasforphotography/ideasforphotography/IdeasForPhotography.Framework/IdeasForPhotography.Framework.csproj.
  Restore completed in 49.74 ms for /Users/will/src/startups/ideasforphotography/ideasforphotography/Application/Application.csproj.
  Restore completed in 49.74 ms for /Users/will/src/startups/ideasforphotography/ideasforphotography/IdeasForPhotography.Domain.ClubIdeas/IdeasForPhotography.Domain.ClubIdeas.csproj.
  IdeasForPhotography.Framework -> /Users/will/src/startups/ideasforphotography/ideasforphotography/IdeasForPhotography.Framework/bin/Debug/netcoreapp3.1/IdeasForPhotography.Framework.dll
  IdeasForPhotography.Domain.ClubIdeas -> /Users/will/src/startups/ideasforphotography/ideasforphotography/IdeasForPhotography.Domain.ClubIdeas/bin/Debug/netcoreapp3.1/IdeasForPhotography.Domain.ClubIdeas.dll
Clubs/ClubApplicationService.cs(19,21): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). [/Users/will/src/startups/ideasforphotography/ideasforphotography/Application/Application.csproj]
Infrastructure/EventDeserializer.cs(21,30): warning CS0168: The variable 'ex' is declared but never used [/Users/will/src/startups/ideasforphotography/ideasforphotography/Application/Application.csproj]
  Application -> /Users/will/src/startups/ideasforphotography/ideasforphotography/Application/bin/Debug/netcoreapp3.1/Application.dll
  Application -> /Users/will/src/startups/ideasforphotography/ideasforphotography/Application/bin/Debug/netcoreapp3.1/Application.Views.dll

Build succeeded.

Clubs/ClubApplicationService.cs(19,21): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). [/Users/will/src/startups/ideasforphotography/ideasforphotography/Application/Application.csproj]
Infrastructure/EventDeserializer.cs(21,30): warning CS0168: The variable 'ex' is declared but never used [/Users/will/src/startups/ideasforphotography/ideasforphotography/Application/Application.csproj]
    2 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.34

因此,当我发布应用程序而不仅仅是构建应用程序时,此配置确实有效,特别是使用此命令

 dotnet publish -c Release
 dotnet publish -c Release