Skip to content

Razor class libraries and static web assets #506

@NormanM123

Description

@NormanM123

Describe the Bug

When using nugetizer to pack Razor class libraries, static web assets that are generated during the build process (like scoped CSS or JavaScript files collocated with a component) are not included in the package. Files under "./wwwroot" are placed under ".contentFiles" in the package, which is the wrong location.

Steps to Reproduce

Create a Razor class library project and add the dependency to nugetizer. In the subfolder "./Components", add a Razor Component "Test.razor" and a scoped CSS file "Test.razor.css." with arbitrary content.

Create a file test.js in the "./wwwroot" folder.

Run dotnet pack on the project.

Expected Behavior

There should be a folder "./staticwebassets" within the package and another .props file in the build folder which copies the static assets during builds of projects that depend on the generated package.

The "./staticwebassets" folder should contain all generated static web assets and all static web assets which have been placed under the "./wwwroot" folder in the project.

Observed Behavior

The "./staticwebassets" folder is not created within the package. Scoped CSS and collocated JavaScript are not included in the package. Files under "./wwwroot" are included as contentFiles.

Removing the dependency to nugetizer and running dotnet pack gives the expected behavior.

Is there a workaround for this without having to remove the dependency to nugetizer?

Back this issue
Back this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions