Razor 类库中的图像 [英] Images in Razor Class Library
本文介绍了Razor 类库中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用图像和其他文件类型,例如 css/js/etc.在 Razor 类库中?我在尝试让 Razor 类库中的图像和 css 显示在 .Net Core 2.1 MVC 应用程序中时遇到问题.
Is it possible to use images and other file types such as css/js/etc. in a Razor Class library? I'm having an issue trying to get the images and css in the Razor Class Library to show up in a .Net Core 2.1 MVC application.
我们曾经使用文件提供程序和 C# 类库,但我觉得 Razor 类库现在应该能够通过简单地在项目中添加对该库的引用来实现这一点.
We used to use the File Provider and a C# class library but I feel like the Razor Class Library should be able to accomplish this now by simply adding a reference to the library in a project.
推荐答案
- 在 razor 类库项目上创建 wwwroot 文件夹,并在其中的图像文件夹中插入您的图像以在视图组件或外部项目上调用图像,您需要制作这样的路径
- src=_content/rclProjectName/images/ajax-load.gif"
- 链接 https://docs.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-5.0&tabs=visual-studio
这篇关于Razor 类库中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文