Enable “Create Unit Tests…” on Visual Studio 2012

Update: If you are having issues with the “Create Unit Tests…” function being disabled, check out this post.

If you have followed from my previous workaround to enable “Create Unit Tests…”, you might be delighted that there’s a permanent solution to this issue.

There are two ways to fully enable “Create Unit Tests…” on Visual Studio 2012 without using keyboard shortcuts or command window. Better still, you can now right click –> Create Unit Tests… as could be seen below:

"Create Unit Tests..." menu enabled
“Create Unit Tests…” menu enabled

There are two ways to enable this, the elegant way or the abnormal way.

Solution 1: The Elegant Way

This solution is rather easy. All you need to do is just download the vssettings file below and add it into settings. Follow these steps:

  1. Download the following file: CreateUnitTest.vssettings
  2. Go to Visual Studio 2012, select TOOLS –> Import and Export Settings.

    Import and Export Settings
    Import and Export Settings
  3. Select “Import selected environment settings” and click Next button.

    Import and Export Settings Wizard
    Import and Export Settings Wizard
  4. Then select “Yes, save my current settings” and click Next button. This step will allow you to restore back to your original setting if you made a mistake.

    Save Current Settings
    Save Current Settings
  5. Then, click Browse, and look for the file you just downloaded (CreateUnitTest.vssettings) and click Open, then Next.

    Select downloaded CreateUnitTest.vssettings
    Select downloaded CreateUnitTest.vssettings
  6. You may receive warnings that mentions about compromising computer. Please do not be alerted as there are no settings with the warning icon. 🙂 Click Finish then it will apply the settings. Lastly click Close to end the wizard.

[adrotate banner=”1″]

There you go, “Create Unit Tests…” menu is BACK! Do leave your comment or like my Facebook Page (not compulsory) whether the solution is working for you or not. 🙂

Create Unit Tests... is back!
Create Unit Tests… is back!

Solution 2: The Alternative Way

This solution was contributed by Serena Yeoh, Windows Azure MVP where the key method is to trick Visual Studio that “Create Unit Tests…” menu is not part of the removed functionality (IsPartialRemoval=”false”) by changing the order of menu in Editor Context Menu | Code Window. Check out the steps:

  1.  Go to Visual Studio 2012, select TOOLS –> Customize…

  2. Click Commands tab, then select Context Menu radio button, and choose Editor Context Menus | Code Window from the dropdown menu.

    Customize Menu
    Customize Menu
  3. Scroll down Controls, til you see “Create Unit Tests…” context menu. Click Move Up or Move Down button and click Close.

    Move Up or Move Down
    Move Up or Move Down
  4. Restart Visual Studio 2012. (Close everything and start your project again)
  5. “Create Unit Tests…” menu is back!
Create Unit Tests... is back!
Create Unit Tests… is back!

Don’t you feel that your productivity in Unit Testing just increased by multifold?

Happy Unit Testing!

37 thoughts on “Enable “Create Unit Tests…” on Visual Studio 2012

    • Thanks Robert. Would appreciate if you could share on how solution 2 did not work for you. Did you try restarting Visual Studio?

  1. “Menu” works OK, however click on checkbox for project inside “Create Unit Tests” windows gives HttpException error messagebox: The given path’s format is not supported.

    Any ideas?

    Thank you

    • Hi Serg,

      Perhaps it would be best if you could provide a screenshot. I am unable to re-produce the issue.



      • i am still unable to create unit test for my .NET ASP project

        I can not complete steps as the dialog box does not allow me to select the project to create tests for. Whenever I try to tick the box, I get an error message : HttpException: The given path’s format is not supported.

        Screenshot: http://i.imgur.com/6WCPIzL.png?1

  2. Hi Dawa,

    “Create Unit Tests…” workaround on Visual Studio 2012 works for C#.NET however, not for C++/CX.

    I tested the workaround in a sample C#.NET Console Application project and C++/CX WindowsRuntimeComponent App project.

    While “Create Unit Tests…” is enabled for C#.NET (Console Application) in Visual Studio 2012, “Create Unit Tests…” is disabled for C++/CX (WindowsRuntimeComponent App) in Visual Studio 2012.

    I had posted this with screenshots in MSDN forum:


    Can you please help?


    • Hi rajanipaypalajani,

      I have tried and it will not work as well. If I tried creating managed test project, the Create Unit Tests… is available but it will prompt me an error saying “Test generation is unsupported for the current project type.” or “Test generation is only supported on /clr:safe C++ projects.”

      I guess we are out of luck in this aside from manually creating test scripts.


  3. Hi Dawa,
    Interesting solution.
    You can also install the online extension called “Unit Test Generator” in VS2012, which provides the same functionality.

    • Riccardo,

      I understand that the extension was added a month ago, where this post was written way back in February. In my humble opinion, I would still prefer to use the import settings method due to the fact that it runs on zero memory footprint rather than having another extension.


  4. I am not able to find CreateUnitTests option from right click on any Method,class or namespace.
    I am using VS 2013.
    Regarding First Solution, I did the same but not CreateUnitTests option available.
    Regarding Second Solution , In command Tab not find CreateUnitTests option.

    Thanks to reply or suggestion on this.

Leave a Reply