Missing snippet in visual studio

半腔热情 提交于 2019-12-21 08:51:10

问题


Same installation of Visual studio on two machines, but in 1 i cant find the snippet "propdp" for DependencyProperty ? I only have prop/propg, cant really understand why. Is there an addon i have to install?


回答1:


Came across this same issue myself today after a fresh install of VS2008 on Win7 64

All I had to do to fix it was to

  1. Go to Tools > Code Snippets Manager
  2. Select Visual C# from the drop down menu
  3. Click Add
  4. Select the NetFx30 directory containing the code snippets, in my case it was...

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC#\Snippets\1033\NetFX30

You should immediately be able to use the code snippet.




回答2:


I think Resharper hides some of the default snippets. It should be enought to enter the snippet and press two time tab.




回答3:


this may help someone in the near fututre...in my case the snipped showed on intellisense but nothing worked on selecting it and pressing enter or click on it until I clicked tab+tab then it work. Good luck!. (i guess i was used to coderush)




回答4:


Just in case anybody have this problem and the previous answer didn't fix it, if you have two folders inside C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC#\Snippets: 1033 and 3082. Copy and paste the whole content from one to the other and started to work.

Trying to import didn't fix it for me but maybe I didn't do it right... don't know...

I found it here: https://stackoverflow.com/a/36829804/5761877 (thanks be given to "elmonopascual")




回答5:


I'm using VS2017 and had the same problem. The only thing that worked for me was:

  1. Go to Tools > Code Snippets Manager
  2. Select CSharp from the dropdown menu
  3. Remove all folders in the listview (save the complete path of them for later steps)
  4. Hit OK
  5. Reopen the Code Snippets Manager
  6. Select CSharp from the dropdown menu
  7. Insert all the folders again with the Add button.

If I don't close and reopen the Manager before add the folders again, the VS2017 will crash and restart when I hit OK, and the snippets still won't work.




回答6:


in my case i went to tools -> Code Snippet Manager, i realized that the path to the snippet i wanted has changed. So when the Path has changed the Snippet folder will be shown with an error. So i copied the Path and followed until i found out where it was missing. Then i browsed all the folders until i located snippet i wanted and my issue was solved.



来源:https://stackoverflow.com/questions/5349402/missing-snippet-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!