dotnet-new-nunit
dotnet-new-nunit copied to clipboard
Feature Request: Add Visual Studio Extension
I use https://github.com/nunit/nunit-vs-templates daily.
This extension has encountered a few bugs since we upgraded it for VS 2017 however - and it appears the preferred solution by MS is now to package dotnet-new formatted templates up in a VSIX. See https://github.com/dotnet/templating/issues/1209#issuecomment-330370805.
I think it would be great if we could instead support VS 2017 templating via this tool, instead of nunit-vs-templates, which seems to work better for VS 2015 and earlier. @rprouse - as maintainer of nunit-vs-templates, would you be happy to have this project as a replacement, if we can get things up and running?
@halex2005 - what do you think? 🙂
One other thought - nunit-vs-templates currently packages some code snippets as well as the main templates. We'd need to work out how to approach that.
I agree with packaging to include in Visual Studio. I find it very annoying dropping to the command line to create new projects, so I tend to just do it manually with the existing class library templates. We would also likely get fewer bugs reported if people were using templates.
As for snippets, if they aren't supported, then they aren't supported. Maybe this project should be for .NET Core and the new CSPROJ format only?
As for snippets, if they aren't supported, then they aren't supported.
From memory, I believe the current snippets are packages as a separate dll in in the same VSIX. I think their independent of the main templates - it's just a matter of getting them in the right place to build a single VSIX in this repo.
Maybe this project should be for .NET Core and the new CSPROJ format only?
My personal use is .NET Framework. I'd personally love for this project to become a full replacement for nunit-vs-templates in VS 2017, including the xamarin and .NET Framework templates. That's down to what @halex2005 wants to do with it however. 😄
About the new csproj format, it can still be for that format, it is usable for any target framework, and everything we use for unit tests, that is class libraries and console apps, where appropriate
@ChrisMaddock, what is your scenario? Would you like to create full .NET Framework projects from command line or directly from Visual Studio?
If you'd like to create full .NET Framework projects from command line, it's easy to implement. Actually, I have implemented it locally already, but I'm waiting for new release of NUnit Test Adapter because it will have significant fix.
For now you can use current template of dotnet new nunit project and change TargetFramework property in csproj file to supported .NET Framework moniker (like net471) manually.
Actually, I have no experience to create Visual Studio extensions. I'll google for information later and if it is easy I'll try to implement an extension.
@halex2005 What fix are you waiting for in the NUnit Test adapter ?
@OsirisTerje, that's one https://github.com/nunit/nunit3-vs-adapter/pull/418 I have settled CI tests for templates and without fix they are red.
@halex2005 Cool. Remember now. I'm planning to get a 3.10 out real soon now, so this will be in that. Seems the related issue was closed in July 2017, so have to handle this in the release notes.
Would you like to create full .NET Framework projects from command line or directly from Visual Studio?
Yes - via Visual Studio is what I want to be able to do. (Sadly editing Winforms by text editor isn't so fun!)
The nunit-vs-templates project gives me the options below in my Add > New Item menu. Unfortunately - these options have been a little buggy since we upgraded nunit-vs-templates for use in VS 2017. That's due to the face that nunit-vs-templates uses an old method to integrate with Visual Studio - a method which has been replaced by the dotnet new template engine.
Rather than convert nunit-vs-templates to the dotnet new format, and end up with two similar projects, I wondered if we could add a VS Extension to this project, and then add the missing templates here. That would mean that we'd have all our templates available for both command line and VS users, across .NET Framework, Xamarin, and the .NET Core work already in this repo. 😄

Actually, I have no experience to create Visual Studio extensions. I'll google for information later and if it is easy I'll try to implement an extension.
The link in the first post makes it look like it shouldn't be too problematic - however, experience tells me to expect the unexpected! Myself, @rprouse and @OsirisTerje have all done work with VS extensions for various other NUnit projects however - fingers crossed we might be able to offer some advice if things don't work out!
I found similar project AspNetCoreTemplatePack. It uses same template engine and have Visual Studio extension. I'll try to create such an extension for nunit when I'll have more spare time. It seems like it's not a big deal.
Awesome - thanks!