简体   繁体   English

Visual Studio 2015 的 MVC 代码段?

[英]MVC Snippets for Visual Studio 2015?

In 2013 Express for Web there were MVC code snippets for adding default actions and post actions ( mvcaction4<\/code> and mvcpostaction4<\/code> ).在 2013 Express for Web 中有用于添加默认操作和发布操作的 MVC 代码片段( mvcaction4<\/code>和mvcpostaction4<\/code> )。 Visual Studio 2015 Community doesn't appear to have these. Visual Studio 2015 社区似乎没有这些。 Is there a particular tool or download I need to install to restore these or get the MVC5 versions?是否需要安装特定工具或下载来恢复这些或获取 MVC5 版本? Or do I need to copy them and stick them in my custom scriptlets?还是我需要复制它们并将它们粘贴到我的自定义脚本中?

"

for mvc4action I have created the snippet for VS 2017 , you will need to create file with '*.snippet' extension , save file then go to Tools menu in VS 2017 ,select Code Snippets Manager and import the file you created 对于mvc4action我创建了VS 2017的代码片段,您需要创建带有'* .snippet'扩展名的文件,保存文件然后转到VS 2017中的工具菜单,选择代码片段管理器并导入您创建的文件

<?xml version="1.0" encoding="utf-8"?>  
<CodeSnippets  
    xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">  
    <CodeSnippet Format="1.0.0">  
        <Header>  
            <Title>mvcaction</Title> 
            <Shortcut>mvc4action</Shortcut>             
        </Header>  
        <Snippet>  
            <Code Language="csharp">  
                <![CDATA[public ActionResult $ActionName$()
                {
                    return View();$end$
                }
          ]]>  
            </Code> 
<Declarations>  
    <Literal>  
        <ID>ActionName</ID>  
        <ToolTip>Replace ActionName.</ToolTip>  
        <Default>Action</Default>  
    </Literal>  
</Declarations>         
        </Snippet>  
    </CodeSnippet>  



</CodeSnippets>

转到 Visual Studio 窗口顶部的搜索栏 ---> 键入 MVC 4 ---> 您将获得下载并安装对 MVC 的支持的选项 ---> 下载并安装,然后代码片段将起作用.

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

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