aspnetcore: Static assets request path problems in preview6

Describe the bug

In preview 6 when there is a wwwroot folder in a blazor library project, the request path of server side and client side are different.

To Reproduce

Steps to reproduce the behavior:

  1. dotnet new a blazor library project with a name that contains ..
  2. Rename the content folder to wwwroot to make use of the new static assets feature add in preview6.
  3. Change the references in the csproj file of the library project to use wwwroot instead of content (There would even not be any proper url path to the assets with client side hosting if this step is skipped. Question: Why doesn’t blazor client side use the new wwwroot support? )
  4. dotnet new a blazor client side and a blazor server side project that reference the library project.
  5. Run and test both project.

Expected behavior

Static assets in both project can be accessed with the same url path.

Actual behavior

The file “background.png” is accessed with different url path: Client side hosting: https://<hostname>/_content/<TheOriginal.LibraryName>/background.png Server side hosting: https://<hostname>/_content/<lowercaselibrarynamewithoutdots>/background.png

Consequence

A blazor library with static assets cannot have a name with ., otherwise it would have different behavior when referenced by client side and server side hostings.

Is there any plan to fix this fault in the futural preview, or some quick fix for the current version?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 26 (16 by maintainers)

Most upvoted comments

nerate the nuget package using dotnet pack. @karthickthangasamy Thank guy, it works. Can you tell me how to include script/link automatically as blazor client side rendering can do? I would not like to manual add it!

@javiercn I am still confused that the razorclasslib template creates a library with .cshtml files while blazor uses .razor files. Does cshtml work also with blazor? And the razorclasslib targets netcoreapp3.0 while the client-side blazor template targets netstandard2.0. How could a blazor project reference a razor class library project?