Skip to content

Building assets using MSBuild & NPM needs further clarification #42409

@MarkStega

Description

@MarkStega

Last year @javiercn helped with a resource bundling issue (#35274). Unfortunately, there is an undesirable side-effect of the method (see the end of #42374 for a demonstration of the problem). I went back to the blog post https://devblogs.microsoft.com/dotnet/build-client-web-assets-for-your-razor-class-library/ and it appears that the reference library never made it out of the alpha stage of development. The sample app doesn't help as it is based upon the same alpha build.

My referenced csproj material.blazor.csproj does the build of js & css assets properly (and builds them only if the outputs are missing or out of date) but is apparently running the npm commands too late to have the generated assets in wwwroot recognized as static web assets.

So three questions/comments:

  1. A working demo of using npm to build static assets without the alpha library would be useful
  2. A new blog post addressing the issues revolving building static web assets would be useful
  3. Instead of content remove/include pairs in the csproj, can I just change the
BeforeTargets="PreBuildEvent"

to an earlier build step. If so, what step would be appropriate. (and are the build steps documented)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions