这可能是另一个简单的问题。我做了研究,却找不到解决问题的办法。我有.net 6 web项目。项目文件夹没有www.root文件夹。我将图像文件夹放置在项目根目录中。也就是说,src\WebUI\映像\其中存在src\WebUI\WebUI.csproj。这些图像仅用于电子邮件模板。
我对开发环境没有任何问题。但是,当我试图将文件部署到服务器时,我注意到版本构建中没有包含图像文件夹。
我在program.cs中有以下中间件
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(app.Environment.ContentRootPath, "images")),
RequestPath = "/images"
});有人能告诉我我在这里错过了什么吗?
发布于 2022-08-09 08:18:28
我刚刚意识到在我的src\WebUI\WebUI.csproj中添加以下问题之后
<ItemGroup>
<Content Include="images\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>https://stackoverflow.com/questions/73287865
复制相似问题