In 2013 Express for Web there were MVC code snippets for adding default actions and post actions (mvcaction4
and mvcpostaction4
). Visual Studio 2015 Community doesn't appear to have these. Is there a particular tool or download I need to install to restore these or get the MVC5 versions? Or do I need to copy them and stick them in my custom scriptlets?
Asked
Active
Viewed 1,807 times
5

Sam
- 9,933
- 12
- 68
- 104
-
Have you tried to create a snippet [this](https://msdn.microsoft.com/en-us/library/ms165394.aspx) way? – Sirwan Afifi Aug 20 '15 at 21:43
-
I am aware of the old way, just don't know if something is missing from my installation or if I'm missing some addon. I can do it manually as a last resort – Sam Aug 21 '15 at 01:18
-
Have you found any MVC snippets? :( I'm missing those too, and cannot believe no one have created any yet. – Michael Brennt Jun 17 '16 at 14:44
-
I also had the problem but it turned out to be Resharper. See [Using VS Code Snippets with Resharper](http://stackoverflow.com/questions/2820446/using-vs-code-snippets-with-resharper). – PJ Jacobs Jan 05 '17 at 21:32
-
you can create your own snippets by installing code snippet extension in VS. – Zeeshan Ahmad Khalil Jul 11 '20 at 11:12
2 Answers
0
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
<?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>

Cyber Progs
- 3,656
- 3
- 30
- 39
0
Go to search bar at the top of the Visual Studio window ---> type MVC 4 ---> you'll get the option to download and install the support for MVC --->download and install and then the snippets will work.

RezA
- 103
- 1
- 8