1、新建net6项目
设置配置信息
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> <GenerateDocumentationFile>True</GenerateDocumentationFile> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.15" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="wwwroot\**" /> </ItemGroup> </Project>
将elementplus文档放入
安装nuget包
Microsoft.Extensions.FileProviders.Embedded
配置 FileProvider
app.UseFileServer(new FileServerOptions { FileProvider = new ManifestEmbeddedFileProvider(typeof(Program).Assembly, "wwwroot") });
发布
双击打开
访问
http://localhost:5000
文件下载地址
标签:elementplus,离线,文档,new,net6,FileProvider From: https://www.cnblogs.com/JohnnyLei/p/17280900.html