c# - MVC 创建已配置的空 mvc 项目

标签 c# asp.net asp.net-mvc visual-studio razor

所以我在网上搜索了一段时间可能太多了,我有一个问题找不到答案。

当创建 MVC Asp.net 项目时,它会自动生成某些文件夹、razor View 布局等。它基本上填充项目并将其与 bootstrap jquery 等链接。

当从示例创建一个空项目时,它不允许我使用 @Script 标签或 @Styles 标签,我必须手动配置 web.config 等等等等

问题是我可以创建一个没有所有 razor View 和布局但链接和配置所有内容的项目吗?我可能不需要所有注册登录 View ,删除它们也需要配置。

最佳答案

您可以创建自定义项目模板 - 请参阅 here说明:

To create a custom project template with the standard Export Template wizard

  1. Create a project.

  2. Edit the project until it is ready to be exported as a template.

  3. As appropriate, edit the code files to indicate where parameter replacement should take place. For more information on parameter replacement, see How to: Substitute Parameters in a Template.

  4. On the File menu, click Export Template. The Export Template wizard opens.

  5. Click Project Template.

  6. If you have more than one project in your current solution, select the projects you want to export to a template.

  7. Click Next.

  8. Select an icon and a preview image for your template. These will appear in the New Project dialog box.

  9. Enter a template name and description.

  10. Click Finish. Your project is exported into a .zip file and placed in the specified output location, and, if selected, imported into Visual Studio.

If you have the Visual Studio SDK installed, you can wrap the finished template in a .vsix file for deployment by using the VSIX Project template. For more information, see Getting Started with the VSIX Project Template.

关于c# - MVC 创建已配置的空 mvc 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37514152/

相关文章:

c# - 如何在 EmguCV 中将图像转换为矩阵,然后将矩阵转换为位图?

Asp.net session 在实时 Web 服务器上很快就会过期

c# - MVC4 应用程序中的 Jquery.min.map 文件 404

asp.net-mvc - ASP.NET MVC 我应该先学习 Webform 吗?

c# - 如何使用 Entity Framework 实现 transient 故障处理模式

c# - Api Controller 可以工作,但 web razor Controller 不能使用 owin

c# - 从 KeyEventArgs 过滤控制键

c# - Windows 窗体组合框中的复杂数据绑定(bind)

c# - 如何从内部的 try/catch 外部打破循环?

c# - 如何打印特定的物理尺寸