简体   繁体   English

MVC创建配置的空mvc项目

[英]MVC create configured empty mvc project

So I searched the web for a while maybe too much and I have a question that I cant find the answer for. 所以我在网上搜索了一段时间也许太多了,我有一个问题,我找不到答案。

When creating a MVC Asp.net project it auto-generates certain folders, razor views a layout etc. etc. It basically fills the project and links it with bootstrap jquery etc. 在创建MVC Asp.net项目时,它会自动生成某些文件夹,剃刀查看布局等。它基本上填充项目并将其与bootstrap jquery等链接。

When creating an empty project from example it doesn't let me use the @Script tag or the @Styles one and I have to manually configure the web.config and etc and etc. 从示例创建一个空项目时,它不允许我使用@Script标记或@Styles ,我必须手动配置web.config等等。

The question is can I create a project without all the razor views and the layout, but with all the stuff linked and configured? 问题是我可以创建一个没有所有剃刀视图和布局的项目,但是所有的东西都链接和配置了吗? I may not need all the register login views and deleting them requires configuration too. 我可能不需要所有注册登录视图,删除它们也需要配置。

You can create a custom project template - See here for instructions: 您可以创建自定义项目模板 - 有关说明,请参阅此处

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 . 在“ File菜单上,单击“ Export Template The Export Template wizard opens. Export Template向导将打开。

  5. Click Project Template . 单击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 . 单击Next

  8. Select an icon and a preview image for your template. 选择模板的图标和预览图像。 These will appear in the New Project dialog box. 这些将显示在“ New Project对话框中。

  9. Enter a template name and description. 输入模板名称和说明。

  10. Click Finish . 单击Finish Your project is exported into a .zip file and placed in the specified output location, and, if selected, imported into Visual Studio. 您的项目将导出到.zip文件中并放置在指定的输出位置,如果选择,则导入到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. 如果安装了Visual Studio SDK,则可以使用VSIX项目模板将完成的模板包装在.vsix文件中以进行部署。 For more information, see Getting Started with the VSIX Project Template. 有关更多信息,请参阅VSIX项目模板入门。

I see this has already been answered, but it seems more complex that what I believe user6321125 is looking for. 我看到这已经得到了解答,但我认为user6321125正在寻找的东西似乎更复杂。 I had to do this too, so I think I understand what you mean. 我也必须这样做,所以我想我明白你的意思。

The answer it to create the project again, but this time on the New Project screen, after selecting ASP.NET MVC, click "Configure authentication" and select "No authentication". 答案是再次创建项目,但这次在New Project屏幕上,选择ASP.NET MVC后,单击“Configure authentication”并选择“No authentication”。

Then you will be given a clean project without all of the login views etc. 然后,您将获得一个没有所有登录视图等的干净项目。

You have to create a Web Application with an empty template and then install MVC on the Nuget Package Manager. 您必须使用空模板创建Web应用程序,然后在Nuget包管理器上安装MVC。

Tools -> Nuget Package Manager -> Manage Nuet Packages for Solution -> Type in the Search box- MVC and Install the MVC Package. 工具 - > Nuget包管理器 - >管理解决方案的Nuet包 - >键入搜索框 - MVC并安装MVC包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM