在 .csproj 中添加下面的配置解决了
<ItemGroup> <Content Update="wwwroot/lib/**" CopyToPublishDirectory="Never" /> <Content Update="wwwroot/lib/**/*.css" CopyToPublishDirectory="PreserveNewest" /> <Content Update="wwwroot/lib/**/*.js" CopyToPublishDirectory="PreserveNewest" /> <Content Update="wwwroot/lib/**/*.png" CopyToPublishDirectory="PreserveNewest" /> <Content Update="wwwroot/lib/**/*.jpg" CopyToPublishDirectory="PreserveNewest" /> </ItemGroup>