Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing a Razor Class Library (or Class Library) can include extraneous static content #42374

Closed
MarkStega opened this issue Jun 15, 2022 · 1 comment
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-static-web-assets ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Milestone

Comments

@MarkStega
Copy link

MarkStega commented Jun 15, 2022

Describe the bug:
An RCL (or a plain 'class library') with a wwwroot folder that has a nuget dependency of a library with static assets duplicates the publish of those assets

Version used:
e.g. VS2022 17.3.0 Preview 2

To reproduce:
Steps to reproduce the behavior:

  1. Create a new RCL in a solution
  2. Create a wwwroot folder in that RCL
  3. Use the nuget package manager to add a reference to Material.Blazor
  4. After a short period of time you will observe 6 css/js files get referenced as links in wwwroot of the RCL
  5. Publish your solution (it is sufficient to publish locally to a directory)
  6. Examine the wwwroot _content folder in the published output
  7. Note the the content for Material.Blazor is replicated in your RCL content.
  8. In this particular case there is an added 2.5Mb of content that serves no purpose.
  9. It is very difficult to exclude these static assets as the path for each developer and github action is different since it references the path to the local github repository. This makes DefaultItemExcludes rather worthless. As an example, my references are in the form of
"C:\Users\ms\.nuget\packages\material.blazor\3.0.0-preview.1\contentFiles\any\net6.0\wwwroot\material-components-web.css"

and the next developer could have references like

"C:\Users\sz\.nuget\packages\material.blazor\3.0.0-preview.1\contentFiles\any\net6.0\wwwroot\material-components-web.css"

Expected behavior:
I don't expect that referencing a nuget package with static assets in an RCL will cause those assets to be published.

Actual behavior:
See point 7 above

Edit:

  1. Clarified that the same issue occurs if you include the nuget reference in a class library

Additional context:
Add any other context about the problem here.

.NET SDK (reflecting any global.json):
 Version:   6.0.400-preview.22301.10
 Commit:    25580ffe7a

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.400-preview.22301.10\

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  3.1.420 [C:\Program Files\dotnet\sdk]
  6.0.301 [C:\Program Files\dotnet\sdk]
  6.0.400-preview.22301.10 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

C:\Users\ms>
@ghost ghost added the untriaged label Jun 15, 2022
@MarkStega MarkStega changed the title Publishing a Razor Class Library can include extraneous static content Publishing a Razor Class Library (or Class Library) can include extraneous static content Jun 15, 2022
@davidwengier davidwengier transferred this issue from dotnet/razor Jun 16, 2022
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/sdk Jun 23, 2022
@mkArtakMSFT mkArtakMSFT added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-static-web-assets and removed untriaged Area-AspNetCore labels Jun 23, 2022
@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Jun 23, 2022
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
It looks like the MaterialBlazor is being packaged incorrectly. As you can see, the assets are also packaged under the content folder:
image

We recommend following up with the MaterialBlazor library authors to get that resolved.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2022
@mkArtakMSFT mkArtakMSFT added question ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. labels Jun 23, 2022
@ghost ghost added the Status: Resolved label Jun 23, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-static-web-assets ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

4 participants