Skip to content

Blazor WASM Does not serve linked files #43840

@MarioGK

Description

@MarioGK

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Files linked are not served when you run the project locally

    <ItemGroup>
        <None Include="..\cv.Common\Data\**\*">
            <Link>wwwroot\Data\%(RecursiveDir)/%(FileName)%(Extension)</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>

When i try to access any file inside the Data folder it returns a 404 error, if i access a file that is not linked like app.css it works correctly.

Expected Behavior

It is supposed to serve static files when they are on the publish|bin output even if they are linked or normal files

Steps To Reproduce

Just create a sample Blazor project, try to link any file like this

    <ItemGroup>
        <None Include="..\cv.Common\Data\**\*">
            <Link>wwwroot\Data\%(RecursiveDir)/%(FileName)%(Extension)</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>

and try to access it http://localhost:5000/filename.txt

Exceptions (if any)

No response

.NET Version

7.0.100-preview.7.22377.5

Anything else?

Tried running it on Visual Studio,Rider and dotnet watch, all of them have the same behaviour

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