none
VS2015 Code snippets for C# are not working

    Question

  • Hi everybody,

    I am trying to use the code snippets prop, propfull, etc. in C# and looks like Intellisense doesn't recognize these code. I looked the Code Snippet Manager for C# and everything looks in order. I tried safemode and repair and nothing works. I have VS 2015 update 1 RC.

    any suggestion?


    Monday, November 09, 2015 7:35 PM

Answers

  • I don't have Rasharper, actually I don't have any plugin just the VS. I did the reset settings and did not work. I installed VS again and now it is working but I didn't install the update RC1, maybe it was the RC1 update.

    Anyway thank you for your help and time!

    cheers!

    • Marked as answer by oesile Thursday, November 12, 2015 3:17 PM
    Thursday, November 12, 2015 3:16 PM

All replies

  • Hi oesile,

    You can try:

    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.

    Best regards, it this was helpful propose as an answer.

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

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

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

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

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

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

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

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

  • Monday, November 09, 2015 9:17 PM
  • Hi oesile,

    Thank you for posting in MSDN forum.

    I tested this issue on my visual studio 2015 Update 1 RC, and it works.

    Please check the following steps:

    • In the Visual Studio integrated development environment (IDE), open the file that you want to edit.

    • In the Code Editor, put the cursor where you want to insert the code snippet.

    • Launch the Insert Code Snippet menu in one of three ways:

      1. Press CTRL+K, CTRL+X. 

      2. On the Edit menu, point to IntelliSense, and then click Insert Snippet.

      3. Right-click the mouse and then select the Insert Snippet command on the shortcut menu.

    • Select the code snippet from the code snippet inserter and then press TAB or ENTER.

      Alternatively, you can type the name of the code snippet, and then press TAB or ENTER.

    You can also check this feature on my environment:

    (1) I input "prop":

    (2) I press the Tab Key:

    Best Regards,

    Jiayi Li


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Tuesday, November 10, 2015 6:33 AM
    Moderator
  • Hi all,

      Thank you for your replies!

    @Jiayi LiMy My problem is that the code snippet doesn't work with any type of insert option. For example when I type Ctrl+K, Ctrl+X, the Insert snippet box is empty, if I press tab then I get the message "Object reference not set to an instance of an object". 

    

    @Almir Vuk also it didn't work. In the code snippets manager looks everything in order.

    Btw, I have vs2013 installed too where the code snippet works fine.


    • Edited by oesile Tuesday, November 10, 2015 9:23 AM
    Tuesday, November 10, 2015 9:22 AM
  • Hi,

    Have you installed Resharper on your machine?

    If you have, please check the following thread to see if it helps: http://stackoverflow.com/questions/2833363/intellisense-has-forgotten-my-code-snippets

    If you don't have, maybe we could think about the VS IDE.

    I suggest you reset your VS settings, and then create a new simple project, test it again.

    https://msdn.microsoft.com/en-us/library/ms247075(v=vs.100).aspx

    But if a simple app worked well, but just your specific app has this issue, to really make sure that it is not related to the project files, please delete .suo file, and then re-open the .xxproj file, clean and build your solution, test it again. Or you could create a new blank solution, and then copy all project files to the new solution, test it again.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Wednesday, November 11, 2015 9:03 AM
    Moderator
  • I don't have Rasharper, actually I don't have any plugin just the VS. I did the reset settings and did not work. I installed VS again and now it is working but I didn't install the update RC1, maybe it was the RC1 update.

    Anyway thank you for your help and time!

    cheers!

    • Marked as answer by oesile Thursday, November 12, 2015 3:17 PM
    Thursday, November 12, 2015 3:16 PM
  • I have the same problem, using the Update 1 RC.

    I have solved the problem by selecting "Import" instead of Add, in response to :

    "You can try:

    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."


    • Proposed as answer by Proton2 Thursday, November 26, 2015 11:36 AM
    • Edited by Proton2 Thursday, November 26, 2015 11:38 AM
    Thursday, November 26, 2015 11:36 AM
  • Hi all

    i had exactly the same issue! i managed to solve it just yet. weirdly, the problem didn't exist when i started VS2015 as Administrator.

    so, the location for the snippets when logged in as Administrator is on "C:\app Folder" while the location for the snippets when loged in as standard user is in the users personal directory (my code snippets), in my case on a Server, not on local HD.

    what i did: i imported via snippet Manager the snippets from "C#" into "my code snippets" and now it works.

    it must have to do with privileges. i re-installed VS2015 before and didn't work either.

    Edit: i probably re-installed while not in the network and therefore my personal directory was unavailable :-/

    Kind regards

    Livio

    Tuesday, May 31, 2016 7:03 AM
  • Hi. Maybe this response is too late, but I post it in case it is useful for someone. I had the same problem. I've installed VS2015 With Update1 and the snippets didn't work. I even ran a installation repair and I reset my settings. In my case the only solution was to "Import" the snippets again. The weird thing is that when I was in snippet manager everything seemed OK despite it wasn't working.

    I did this:

    1. Go to Snippet Manager (Tools > Code Snippets Manager)
    2. Select Visual CSharp from dropdown list
    3. Select Visual C# Folder
    4. Above the treeview the location of the snippets for the selected folder is shown
    5. Copy the location
    6. Press "Import" Button
    7. Paste the previously copied location
    8. Select all files and press "open"
    9. A dialog asking to select destination for each snippet is open, by default all snippets are checked to be located in "My Code Snippets" folder, if this is not the case, select all snippets and check the mentioned folder.
    10. Click Finish

    Now the snippets works again. The question is, Why if everything looks OK, the default snippets don't work and I have to import them as if they were custom files?

    Thursday, June 23, 2016 3:15 PM
  • Super! thanks

    Thursday, July 07, 2016 9:26 PM
  • Thanks a lot.

    Running as Administrator worked perfectly :-)

    // Søren

    Tuesday, July 12, 2016 7:57 AM
  • Thank you very much! it did work pretty good!
    • Proposed as answer by morgaje Friday, February 24, 2017 10:04 PM
    • Unproposed as answer by morgaje Friday, February 24, 2017 10:09 PM
    Saturday, September 24, 2016 3:49 PM
  • Thanks LPatera, I launched Visual Studio 2015 as an administrator in Windows 10 using the following steps and this corrected the issue with importing a snippet into Visual Studio:

    On Windows 10 Start Menu select All Apps.

    • Right click on Visual Studio 2015 Icon.
    • Select "More" from the Menu.
    • Choose Run as Administrator.

      And afterwards followed the steps to import the snippet using the url below:

      https://msdn.microsoft.com/en-us/library/ms165394.aspx

    Friday, February 24, 2017 10:09 PM