{"id":31811991,"url":"https://github.com/s8usy429/built-in-code-analysis-project-templates-vsix","last_synced_at":"2026-05-14T20:06:46.131Z","repository":{"id":169639767,"uuid":"469134181","full_name":"s8Usy429/built-in-code-analysis-project-templates-vsix","owner":"s8Usy429","description":"Visual Studio extension adding new project templates with built-in code analysis","archived":false,"fork":false,"pushed_at":"2023-11-12T18:17:24.000Z","size":389,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T06:59:50.663Z","etag":null,"topics":["analyzers","code-analysis","dotnet","project-templates","templates","visual-studio","visual-studio-extension"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s8Usy429.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2022-03-12T16:15:46.000Z","updated_at":"2023-11-09T03:47:46.000Z","dependencies_parsed_at":"2023-11-12T18:35:44.995Z","dependency_job_id":null,"html_url":"https://github.com/s8Usy429/built-in-code-analysis-project-templates-vsix","commit_stats":null,"previous_names":["s8usy429/built-in-code-analysis-project-templates-vsix"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/s8Usy429/built-in-code-analysis-project-templates-vsix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s8Usy429%2Fbuilt-in-code-analysis-project-templates-vsix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s8Usy429%2Fbuilt-in-code-analysis-project-templates-vsix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s8Usy429%2Fbuilt-in-code-analysis-project-templates-vsix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s8Usy429%2Fbuilt-in-code-analysis-project-templates-vsix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s8Usy429","download_url":"https://codeload.github.com/s8Usy429/built-in-code-analysis-project-templates-vsix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s8Usy429%2Fbuilt-in-code-analysis-project-templates-vsix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33041262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzers","code-analysis","dotnet","project-templates","templates","visual-studio","visual-studio-extension"],"created_at":"2025-10-11T06:59:49.159Z","updated_at":"2026-05-14T20:06:46.113Z","avatar_url":"https://github.com/s8Usy429.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# built-in-code-analysis-project-templates-vsix\n\u003cp\u003e\n    A Visual Studio extension adding new project templates with built-in code analysis.\u003cbr/\u003e\n    The extension is for Visual Studio 2022 and above.\u003cbr/\u003e\n    This extension makes sure \u003ca href=\"https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#third-party-analyzers\"\u003erecommended analyzers\u003c/a\u003e are installed and enabled at all time.\u003cbr/\u003e\n    \u003cul\u003e\n        \u003cli\u003e.NET analyzers\u003c/li\u003e\n        \u003cli\u003eSonarAnalyzer\u003c/li\u003e\n        \u003cli\u003eRoslynator (for C# projects only)\u003c/li\u003e\n        \u003cli\u003eFluentAssertions.Analyzers (for test projects only)\u003c/li\u003e\n        \u003cli\u003exunit.analyzers (for test projects only)\u003c/li\u003e\n    \u003c/ul\u003e\n\u003c/p\u003e\n\n## Overview\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd colspan=\"2\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/add_project_dialog.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eVisual Studio New Project Dialog with the new templates\u003c/i\u003e\u003c/div\u003e\n\t\t\t\u003cbr/\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/overview1.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eC# Console Application\u003c/i\u003e\u003c/div\u003e\n\t\t\t\u003cbr/\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/overview2.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eC# xUnit Test Project\u003c/i\u003e\u003c/div\u003e\n\t\t\t\u003cbr/\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/overview3.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eLinq query optimization detected\u003c/i\u003e\u003c/div\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/overview4.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eWeak encryption algorithm detected\u003c/i\u003e\u003c/div\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cbr/\u003e\n\n## List of project templates\n\n| Language | Type          | Compatible Frameworks                            | Name                                                            | Included Analyzers                                                                     |\n|:--------:|:-------------:|:------------------------------------------------:|:---------------------------------------------------------------:|:--------------------------------------------------------------------------------------:|\n| C#       | Console App   | .NET Core 3.1, .NET 5, .NET 6                    | Console App with built-in code analysis                         | .Net analyzers, SonarAnalyzer, Roslynator                                              |\n| C#       | Console App   | .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8     | Console App with built-in code analysis (.NET Framework)        | .Net analyzers, SonarAnalyzer, Roslynator                                              |\n|          |               |                                                  |                                                                 |                                                                                        |\n| C#       | Class Library | .Net Standard 2.1, .NET Core 3.1, .NET 5, .NET 6 | Class Library with built-in code analysis                       | .Net analyzers, SonarAnalyzer, Roslynator                                              |\n| C#       | Class Library | .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8     | Class Library with built-in code analysis (.NET Framework)      | .Net analyzers, SonarAnalyzer, Roslynator                                              |\n|          |               |                                                  |                                                                 |                                                                                        |\n| C#       | Test/xUnit    | .NET Core 3.1, .NET 5, .NET 6                    | xUnit Test Project with built-in code analysis                  | .Net analyzers, SonarAnalyzer, Roslynator, xunit.analyzers, FluentAssertions.Analyzers |\n| C#       | Test/xUnit    | .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8     | xUnit Test Project with built-in code analysis (.NET Framework) | .Net analyzers, SonarAnalyzer, Roslynator, xunit.analyzers, FluentAssertions.Analyzers |\n|          |               |                                                  |                                                                 |                                                                                        |\n| VB       | Console App   | .NET Core 3.1, .NET 5, .NET 6                    | Console App with built-in code analysis                         | .Net analyzers, SonarAnalyzer                                                          |\n| VB       | Console App   | .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8     | Console App with built-in code analysis (.NET Framework)        | .Net analyzers, SonarAnalyzer                                                          |\n|          |               |                                                  |                                                                 |                                                                                        |\n| VB       | Class Library | .Net Standard 2.1, .NET Core 3.1, .NET 5, .NET 6 | Class Library with built-in code analysis                       | .Net analyzers, SonarAnalyzer                                                          |\n| VB       | Class Library | .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8     | Class Library with built-in code analysis (.NET Framework)      | .Net analyzers, SonarAnalyzer                                                          |\n\n\u003cbr/\u003e\n\n## Pros of using analyzers\n\n* Write compliant code\n  * More secure (will detect weak hash algorithms, hard-coded sensitive stuff, etc.)\n  * More optimized (will detect and autofix slow database queries, etc.)\n  * Less error prone (will detect code smells, dead code, etc.)\n* Happens during development phase (fixes code as soon as possible)\n* Friendlier pull request (code already cleaned and optimized)\n* CI will complain less (code already compliant)\n\n\u003cbr/\u003e\n\n## Installation guide\n\n1. Download \u003ca href=\"https://github.com/s8Usy429/built-in-code-analysis-vs-project-templates-extension/releases/latest\"\u003ethe latest release\u003c/a\u003e:\u003cbr/\u003e\n![Install Step1](doc/install_step1.png)\n\n2. Launch the installer:\u003cbr/\u003e\n![Install Step2](doc/install_step2.png)\n\n3. Select at least one target Visual Studio version where the extension should be installed:\u003cbr/\u003e\n![Install Step3](doc/install_step3.png)\n\n4. Close Visual Studio instances if the installer complains about it.\n\n5. That's it. You can check the extension has been installed successfuly from Visual Studio extension window:\u003cbr/\u003e\n![Install Step4](doc/install_step4.png)\n\n\u003cbr/\u003e\n\n## Usage\n\n1. Open Visual Studio \"Create a new project\" window.\n\n2. All the new projects will show up at the top (it will until you use them).\n\n3. At anytime, you can filter the list of projects on the \"Analyzed\" project type.\u003cbr/\u003e\nThis, will show only projects added by this extension\u003cbr/\u003e\n![Usage3](doc/usage3.png)\n\n4. Let us create an instance of \"xUnit Test Project with built-in code analysis\":\n\n5. Wait for Visual Studio to restore nuget packages, or trigger it yourself.\n\n6. Visual Studio 2022 conveniently shows the list of installed analyzers from the \"Solution Explorer\" window:\u003cbr/\u003e\n![Usage4](doc/overview2.png)\u003cbr/\u003e\u003cbr/\u003e\nNotice, the extension has installed the following analyzers:\n   * FluentAssertions.Analyzers (assuming you are going to use FluentAssertions which is also installed by this extension)\n   * .Net Analyzers\n   * Roslynator\n   * SonarAnalyzer\n   * (xunit.analyzers is now already included when installing xunit. This is not included by this extension.)\n\n7. If you are curious, you can see the list of all the rules for each analyzer:\u003cbr/\u003e\n![Usage5](doc/usage5.png)\n\n8. Enjoy coding easier !\n\n\u003cbr/\u003e\n\n## Developper guide\n\nActually, the extension just provides a way to deploy the project templates.\u003cbr/\u003e\nIt is an empty extension (no code) and just references a local nuget package which does contain the project templates.\u003cbr/\u003e\nThe reason it is done like this is because the templates have nothing to do with Visual Studio. They are \"dotnet new XXX\" style projects.\u003cbr/\u003e\nActually you can achieve this if you go an install the local nuget package like this:\u003cbr/\u003e\n\u003ccode\u003e# Create the nuget package\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003edotnet pack templates/_ignore.csproj -o templates\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003e# Install the nuget package to work with dotnet CLI\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003edotnet new --install templates/ProjectsWithAnalyers.Templates.1.0.0.nupkg\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003e# Verify installed templates\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003edotnet new -l # the output will contain the templates shiped inside the nuget package\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003e# How to uninstall\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003edotnet new --uninstall templates/ProjectsWithAnalyers.Templates.1.0.0.nupkg\u003c/code\u003e\n\nUsing the extension basically does all that without impacting your dotnet CLI installation though (templates won't show up in \u003ccode\u003edotnet new -l\u003c/code\u003e).\u003cbr/\u003e\nTo make sure the extension is always deploying the latest version of the nuget package, the extension recreates the package using the following pre-build event:\u003cbr/\u003e\n\u003ccode\u003edotnet pack \"\\$(SolutionDir)templates\\_ignore.csproj\" -o \"\\$(SolutionDir)templates\"\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003eRD /S /Q \"\\$(SolutionDir)templates\\bin\"\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003eRD /S /Q \"\\$(SolutionDir)templates\\obj\"\u003c/code\u003e\u003cbr/\u003e\n\n\u003cbr/\u003e\n\n### Build and run the extension:\n\n1. Install the extensibility module from Visual Studio Installer:\n![Develop Guide1](doc/develop_guide1.png)\n\n2. Install the \"Extensibility Essentials 2022\" extension from Visual Studio managment window:\n![Develop Guide2](doc/develop_guide2.png)\n\n3. Open the solution within Visual Studio, build and run.\u003cbr/\u003e\nVisual Studio will start an experimental instance of Visual Studio with the extension installed.\n\n4. Within the newly started experimental instance, navigate to the \"Create new project\" window. The project templates will show up.\n\n\u003cbr/\u003e\n\n### Understand how the templates are packed\nAll the templates are located within the \"templates\" folder:\u003cbr/\u003e\n![Develop Guide3](doc/develop_guide3.png)\u003cbr/\u003e\nThe \"_ignore.csproj\" is a fake project just to be able to use the \u003ccode\u003edotnet pack\u003c/code\u003e command.\u003cbr/\u003e\nThe \u003ccode\u003edotnet pack\u003c/code\u003e command currently requires a project to create a nuget package. Microsoft is working on it, but it is not there yet.\u003cbr/\u003e\nThe nuget simply contains the file like a zip archive would do. There is no C#/VB code whatsoever. Just raw files packed in.\u003cbr/\u003e\nThe extension creates the package on build using the following pre-build event:\u003cbr/\u003e\n\u003ccode\u003edotnet pack \"\\$(SolutionDir)templates\\_ignore.csproj\" -o \"\\$(SolutionDir)templates\"\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003eRD /S /Q \"\\$(SolutionDir)templates\\bin\"\u003c/code\u003e\u003cbr/\u003e\n\u003ccode\u003eRD /S /Q \"\\$(SolutionDir)templates\\obj\"\u003c/code\u003e\u003cbr/\u003e\n\n\u003cbr/\u003e\n\n### What's inside template folders ?\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/develop_guide4.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eC# Console Application\u003c/i\u003e\u003c/div\u003e\n\t\t\t\u003cbr/\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd valign=\"center\" align=\"center\"\u003e\n\t\t\t\u003cimg src=\"doc/develop_guide5.png\"/\u003e\n\t\t\t\u003cdiv\u003e\u003ci\u003eVB legacy Console Application\u003c/i\u003e\u003c/div\u003e\n\t\t\t\u003cbr/\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n| Item                             | Name can be changed | Description                                                                                                                                                   |\n|----------------------------------|:-------------------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| .template.config                 | No                  | A folder that contains the template configuration                                                                                                             |\n| icon.png                         | No                  | (Optional) The icon the template will display within \"Visual Studio New Project Dialog\" window.\u003cbr/\u003eIf not set, Visual Studio provides a default icon anyway. |\n| template.json                    | No                  | The configuration of the template.                                                                                                                            | \n| csappwithanalyzers.csproj        | Yes                 | A file that will be created when creating an instance of the template. Could be any file.                                                                     |\n| Program.cs                       | Yes                 | A file that will be created when creating an instance of the template. Could be any file.                                                                     |\n|                                  |                     |                                                                                                                                                               |\n| My Project                       | Yes                 | A folder that will be created when creating an instance of the template. Could be any folder.                                                                 |\n| -.-                              | No                  | An empty file ignored by the template engine when we need to create an empty folder. This file won't be created when creating an instance of the template.    |\n| Module1.vb                       | Yes                 | A file that will be created when creating an instance of the template. Could be any file.                                                                     |\n| vbappwithanalyzers_legacy.csproj | Yes                 | A file that will be created when creating an instance of the template. Could be any file.                                                                     |\n\n\u003cbr/\u003e\n\n### Learn more about dotnet template engine\n\u003ca href=\"https://github.com/dotnet/templating/wiki\"\u003eHome for the .NET Core Template Engine\u003c/a\u003e\u003cbr/\u003e\n\u003ca href=\"https://github.com/sayedihashimi/template-sample\"\u003esayedihashimi sample repository\u003c/a\u003e\n\n\u003cbr/\u003e\n\n## Miscellaneous/Troubleshooting \n\u003cp\u003eThis extension will only work on VS2022 and above !!! The installer won't let you install it on VS2019 anyway.\u003c/p\u003e\n\u003cp\u003eThere is no plan to add a template for creating xUnit tests using VB. Turns out you can just use a C# xUnit test project to test VB stuff.\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs8usy429%2Fbuilt-in-code-analysis-project-templates-vsix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs8usy429%2Fbuilt-in-code-analysis-project-templates-vsix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs8usy429%2Fbuilt-in-code-analysis-project-templates-vsix/lists"}