{"id":61595,"date":"2021-12-29T08:00:36","date_gmt":"2021-12-29T07:00:36","guid":{"rendered":"https:\/\/drafts.code-maze.com\/?p=60243"},"modified":"2022-01-15T19:08:44","modified_gmt":"2022-01-15T18:08:44","slug":"dotnet-project-templates-creation","status":"publish","type":"post","link":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/","title":{"rendered":"Creating .NET Project Templates"},"content":{"rendered":"<p>In this article, we are going to talk about creating .NET Project Templates.<\/p>\n<div style=\"padding: 20px; border-left: 5px #dc2323 solid; display: block; margin-bottom: 20px; box-shadow: 1px 1px 5px 0px lightgrey;\">To download the source code for this article, you can visit our <a href=\"https:\/\/github.com\/CodeMazeBlog\/CodeMazeGuides\/tree\/main\/dotnet-projects\/ProjectTemplates\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Let&#8217;s get started.<\/p>\n<h2><a id=\"intro\"><\/a>What are .NET Project Templates?\u00a0\u00a0<\/h2>\n<p>We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code. The .NET SDK comes with a set of default templates to cover the essential project types that we may require like the <strong>Console Apps<\/strong>, <strong>Class Libraries<\/strong>, <strong>ASP.NET Core apps,<\/strong> etc.<\/p>\n<p>To see all the available templates, we can use the <code>dotnet new<\/code> command with the <code>--list<\/code> option:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new --list<\/code><\/p>\n<p>This will list all built-in templates as well as the custom ones if we have installed any.<\/p>\n<p>However, sometimes we may need to create our project templates for specific contexts. For instance, an organization may have a requirement that all projects that they create need to follow a specific structure and format. The .NET CLI includes a template engine, which can create projects from a specified template. We are going to see how we can create our project template to use with .NET CLI and Visual Studio.<\/p>\n<h2><a id=\"creating\"><\/a>How to Create a .NET Project Template?\u00a0<\/h2>\n<p>For that, first, let&#8217;s prepare a project.<\/p>\n<p>We can start by creating a standard ASP.NET Core Web API project and then customizing it.<\/p>\n<p>That said, let&#8217;s create a new project using dotnet CLI:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new webapi -o codemazeapi<\/code><\/p>\n<p>Since we specify the output folder name as <code>codemazeapi<\/code>, this will create a new folder named <code>codemazeapi<\/code>\u00a0and an ASP.NET Core Web API project named <code>codemazeapi<\/code> inside it. The project will have the structure of a standard ASP.NET Core Web API:<\/p>\n<p><a href=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/default-web-api-project-template.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-61597\" src=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/default-web-api-project-template.png\" alt=\"default web api project template while creating .NET Project Templates\" width=\"237\" height=\"193\" \/><\/a>\u00a0<\/p>\n<p>Now we are going to customize this project a bit. First,\u00a0 let&#8217;s remove the <code>WeatherForecastController<\/code> and the <code>WeatherForecast<\/code> class. Then let&#8217;s add a <code>ValuesController<\/code> inside the <code>Controller<\/code> folder with just a <code>GET<\/code> action method:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class ValuesController : ControllerBase\r\n{\r\n    public IActionResult Get()\r\n    {\r\n        return Ok(\"Hi from Code-Maze Web API Template\");\r\n    }\r\n}<\/pre>\n<p>Finally, in the <code>launchSettings.json<\/code> file, let&#8217;s modify the <code>launchUrl<\/code> value to <code>api\/values<\/code>. This will make sure the application hits this controller endpoint on start-up.<\/p>\n<p>Note that in this example we are working with .NET 6. If we use a different version, the default templates and source files could be a little different, but we can always customize those to match this example.<\/p>\n<p>Our customized Web API project is ready. The next step is to create a template out of it.<\/p>\n<h3>Creating Template from Existing .NET Project<\/h3>\n<p>For creating a template from an existing project, we need to create a new folder <code>.template.config<\/code> i<span class=\"pln\">n the root of the project and<\/span> add a <code>template.json<\/code> file inside it. This file is the most important part of building our custom template. It contains all the key information required for transforming our .NET project into a project template:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\r\n  \"$schema\": \"http:\/\/json.schemastore.org\/template\",\r\n  \"author\": \"Muhammed Saleem\",\r\n  \"classifications\": [ \"Web\", \"WebAPI\", \"C#\" ],\r\n  \"identity\": \"CodeMazeTemplates.WebAPI\",\r\n  \"name\": \"Code-Maze Web API Template\",\r\n  \"shortName\": \"codemazeapi\",\r\n  \"tags\": {\r\n    \"language\": \"C#\",\r\n    \"type\": \"project\"\r\n  }\r\n}<\/pre>\n<ul>\n<li><code>$schema<\/code>&#8211; It defines the schema for the JSON file.<\/li>\n<li><code>author<\/code>&#8211; defines the author of the template<\/li>\n<li><code>classifications<\/code>&#8211; This is used to classify and group the templates. It becomes easier to search and find templates based on the values we provide for this property<\/li>\n<li><code>identity<\/code>&#8211; It uniquely identifies the template<\/li>\n<li><code>name<\/code>&#8211; the name of the template when it is listed<\/li>\n<li><code>shortName<\/code>&#8211; a short name that we can use while creating a new project from the template using <code>dotnet new<\/code><\/li>\n<li><code>tags<\/code>&#8211; defines a set of tags for the project. Here we specify that it is a <code>project<\/code> template in the <code>C#<\/code> language<\/li>\n<\/ul>\n<p>With this, our custom project template is ready. The next step is to install it.<\/p>\n<p>For installing the project template locally,\u00a0 we have to run the <code>dotnet new<\/code> with the <code>--install<\/code> or <code>-i<\/code> command from the project root directory:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new -i .<\/code><\/p>\n<p>Notice that we used <code>.<\/code> argument with the <code>install<\/code> command to indicate the template is located in the current folder. If our template location is different, we need to specify that folder path instead.<\/p>\n<p>This will install the template package locally:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">The following template packages will be installed:\r\n   C:\\code-maze-repo\\templates\\codemazeapi\r\n\r\nSuccess: C:\\code-maze-repo\\templates\\codemazeapi installed the following templates:\r\nTemplate Name               Short Name   Language  Tags\r\n--------------------------  -----------  --------  -------------\r\nCode-Maze Web API Template  codemazeapi  [C#]      Web\/WebAPI\/C#<\/pre>\n<p>Now if we run the <code>dotnet new --list<\/code> command, it will list our custom template along with the .NET default templates:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-highlight=\"14\">Template Name                                 Short Name           Language    Tags\r\n--------------------------------------------  -------------------  ----------  -------------------------------------\r\nASP.NET Core Empty                            web                  [C#],F#     Web\/Empty\r\nASP.NET Core gRPC Service                     grpc                 [C#]        Web\/gRPC\r\nASP.NET Core Web API                          webapi               [C#],F#     Web\/WebAPI\r\nASP.NET Core Web App                          razor,webapp         [C#]        Web\/MVC\/Razor Pages\r\nASP.NET Core Web App (Model-View-Controller)  mvc                  [C#],F#     Web\/MVC\r\nASP.NET Core with Angular                     angular              [C#]        Web\/MVC\/SPA\r\nASP.NET Core with React.js                    react                [C#]        Web\/MVC\/SPA\r\nASP.NET Core with React.js and Redux          reactredux           [C#]        Web\/MVC\/SPA\r\nBlazor Server App                             blazorserver         [C#]        Web\/Blazor\r\nBlazor WebAssembly App                        blazorwasm           [C#]        Web\/Blazor\/WebAssembly\/PWA\r\nClass Library                                 classlib             [C#],F#,VB  Common\/Library\r\nCode-Maze Web API Template                    codemazeapi          [C#]        Web\/WebAPI\/C#\r\nConsole App                                   console              [C#],F#,VB  Common\/Console\r\n...<\/pre>\n<p>We have created our .NET project template and installed it locally. The next step is to create a project using that template.<\/p>\n<h3>Creating New Projects Using a Custom Template<\/h3>\n<p>For creating a new project using our template, we can use the <code>dotnet new<\/code> command:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi<\/code><\/p>\n<p>This will create a new project based on the <code>codemazeapi<\/code> template.<\/p>\n<p>Note that the project and solution have the same name as the template. Similarly, it uses the same namespace as defined in the template. Additionally, we can notice that this command did not create a project folder, it just creates the project in the same folder where we ran the above command. In the next section, we&#8217;ll look at how to customize all these.<\/p>\n<h2><a id=\"inbuilt\"><\/a>Customizing .NET Project Templates<\/h2>\n<p>Even though we have created a custom project template and created a new project from that template, right now it doesn&#8217;t do anything exciting other than copying the source files from the original project folder. However, it is possible to customize the template by modifying the <code>template.json<\/code> file and providing additional parameters while creating projects. Let&#8217;s take a look at a few parameters that come out of the box with .NET templates.<\/p>\n<h3>The Output Parameter<\/h3>\n<p>While creating new projects using <code>dotnet new<\/code>, it is possible to specify an output folder by using the <code>-o<\/code>\u00a0parameter:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">dotnet new codemazeapi -o MyFirstAPI<\/code><\/p>\n<p>This will create a new output folder and place the project files inside it. It is a good way to organize projects into separate folders, but the rest of the project contents remain as it is.\u00a0<\/p>\n<h3>The SourceName Parameter<\/h3>\n<p>Now let&#8217;s take a look at the <code class=\" language-json\"><span class=\"token property\">sourceName<\/span><\/code> parameter. This represents the name of the project and the namespace that it uses. Once we specify this in the <code>template.json<\/code> file, it acts as a placeholder and we can override that value while creating projects using the <code>-n<\/code>\u00a0parameter:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-highlight=\"4\">{\r\n...\r\n  \"shortName\": \"codemazeapi\",\r\n  \"sourceName\": \"codemazeapi\",\r\n  \"tags\": {\r\n    \"language\": \"C#\",\r\n    \"type\": \"project\"\r\n  }\r\n}<\/pre>\n<p>After making any changes to the template, we need to uninstall and reinstall the template to update it with the latest changes.<\/p>\n<p>For uninstalling the template, we can use <code>dotnet new -u<\/code> command.\u00a0 Along with that, we need to either specify the folder of the template or use the <code>.<\/code> argument if we are running this command from the template&#8217;s root folder:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new -u .<\/pre>\n<p>This will uninstall the template. We can install it once again using the <code>dotnet new -i<\/code>\u00a0 as we did in the earlier section.<\/p>\n<p>After installing the updated template, let&#8217;s create a new project once again. This time, let&#8217;s specify the project name argument as well:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi -n MySecondAPI<\/pre>\n<p>This creates a new project as before, but this time we can see it renames the project and solution file with the name that we specified:<\/p>\n<p><a href=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/project-with-name-specified.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-61599\" src=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/project-with-name-specified.png\" alt=\"project with name specified\" width=\"172\" height=\"161\" \/><\/a><\/p>\n<p>Additionally, we can see that the namespace is also updated with the name that we provided.<\/p>\n<p>However, in this case, we can see that the template creates a new project in the folder in which we ran the command and did not create a separate project folder.<\/p>\n<p>To continue on, let&#8217;s see how we can create a new project folder based on the project name.<\/p>\n<h3>The PreferNameDirectory Property<\/h3>\n<p>The <code>preferNameDirectory<\/code> parameter, once set to true, will match the output folder with the name of the project:\u00a0<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\" data-enlighter-highlight=\"5\">{\r\n...\r\n  \"shortName\": \"codemazeapi\",\r\n  \"sourceName\": \"codemazeapi\",\r\n  \"preferNameDirectory\":true,\r\n  \"tags\": {\r\n    \"language\": \"C#\",\r\n    \"type\": \"project\"\r\n  }\r\n}<\/pre>\n<p>Let&#8217;s uninstall and install the template once again to update it with the latest changes. After that let&#8217;s create a new project once again using the updated template:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi -n MyThirdAPI<\/pre>\n<p>This time we can see that it created a new output folder matching the project name and then creates the project files inside it. This is pretty cool and almost matches the capabilities that an inbuilt .NET project template provides.<\/p>\n<h2><a id=\"customparams\"><\/a>Creating Custom Parameters for .NET Project Templates<\/h2>\n<p>It is possible to configure the templates to accept custom parameters and customize the projects based on that. In this section, we are going to see how to implement that.<\/p>\n<p>For defining custom parameters, we\u00a0can use the <code>symbols<\/code> property :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">{\r\n...\r\n  \"symbols\":{\r\n    \"domain\": {\r\n        \"type\": \"parameter\",\r\n        \"description\": \"Your domain.\",\r\n        \"defaultValue\": \"mydomain.com\",\r\n        \"replaces\":\"{DOMAIN}\"\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<p>In this example, we define just one parameter called <code>domain<\/code>.\u00a0<\/p>\n<p>Each parameter has these properties:<\/p>\n<ul>\n<li><code>type<\/code>&#8211; This defines the type of symbol, which is the <code>parameter<\/code> in this case<\/li>\n<li><code>description<\/code>&#8211; Provides a description for the parameter<\/li>\n<li><code>defaultValue<\/code>&#8211; If the user does not provide a value for the parameter, it takes this as the default value<\/li>\n<li><code>replaces<\/code>&#8211; This is a placeholder that we can specify in the template&#8217;s source code. While creating projects, the templating engine will replace all instances of this value with user-specified or default values<\/li>\n<\/ul>\n<p>Along with that, let&#8217;s modify the controller to include the <code>{DOMAIN}<\/code> placeholder:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class ValuesController : ControllerBase\r\n{\r\n    public IActionResult Get()\r\n    {\r\n        return Ok(\"Hi from {DOMAIN} Web API Template\");\r\n    }\r\n}<\/pre>\n<p>To see the parameter in action, let&#8217;s uninstall and install the template once again.<\/p>\n<p>For checking the available parameters, we can use the help <code>-h<\/code>\u00a0argument:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi -h<\/pre>\n<p>We can see that the custom parameter is now listed as an option.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">Code-Maze Web API Template (C#)\r\nAuthor: Muhammed Saleem\r\nOptions:\r\n  -d|--domain  Your domain.\r\n               string - Optional\r\n               Default: {DOMAIN}<\/pre>\n<p>Now let&#8217;s create a new project and provide the parameter value :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi -n MyFourthAPI --domain code-maze.com<\/pre>\n<p>This will generate a new project and we can see that it replaces the domain placeholder with the value that we provided:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public IActionResult Get()\r\n{\r\n    return Ok(\"Hi from code-maze.com Web API Template\");\r\n}<\/pre>\n<p>Of course, if we do not provide the parameter, it will use the default value:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public IActionResult Get()\r\n{\r\n    return Ok(\"Hi from mydomain.com Web API Template\");\r\n}<\/pre>\n<h2><a id=\"optional\"><\/a>Adding Optional Contents to a .NET Project Template\u00a0<\/h2>\n<p>Our next step is to make some parts of the template optional and to give users the ability to choose it.<\/p>\n<p>Let&#8217;s add a new method to the <code>ValuesController<\/code> and make it optional:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">#if (EnableContactInfo)\r\n        [Route(\"about\")]\r\n        public IActionResult About()\r\n        {\r\n            return Ok(\"visit us at https:\/\/code-maze.com\/about\/\");\r\n        }\r\n#endif<\/pre>\n<p>Here we are using the C# <code>#if preprocessor directive<\/code> to define an optional section in the template by using the parameter <code>EnableContactInfo<\/code>. Similarly, while modifying other file types, we need to use the supporting syntax.\u00a0<\/p>\n<p>Along with that, let&#8217;s add the <code>EnableContactInfo<\/code> parameter in <code>template.json<\/code> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-highlight=\"10-14\">{\r\n...\r\n  \"symbols\":{\r\n    \"domain\": {\r\n        \"type\": \"parameter\",\r\n        \"description\": \"Your domain.\",\r\n        \"defaultValue\": \"mydomain.com\",\r\n        \"replaces\":\"{DOMAIN}\"\r\n    },\r\n    \"EnableContactInfo\": { \r\n        \"type\": \"parameter\", \r\n        \"dataType\":\"bool\", \r\n        \"defaultValue\": \"false\" \r\n    }\r\n  }\r\n}\r\n<\/pre>\n<p>We define the <code>datatype<\/code> as <code>bool<\/code> to indicate that this accepts a <code>true<\/code> or <code>false<\/code> value.<\/p>\n<p>Now let&#8217;s add a new controller and see how to make it optional.<\/p>\n<p>To do that, we are going to add a <code>ContactController<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class ContactController : ControllerBase\r\n{\r\n    public IActionResult Get()\r\n    {\r\n        return Ok(\"visit us at https:\/\/code-maze.com\/contact\/\");\r\n    }\r\n}<\/pre>\n<p>Then let&#8217;s modify the <code>template.json<\/code> file to specify that <code>ContactController<\/code> should be optional based on <code>EnableContactInfo<\/code> parameter:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\r\n...\r\n  \"sources\": [\r\n    {\r\n      \"modifiers\": [\r\n        {\r\n          \"condition\": \"(!EnableContactInfo)\",\r\n          \"exclude\": [\r\n            \"Controllers\/ContactController.cs\"\r\n          ]\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>Here we add a <code>modifier<\/code> to the <code>sources<\/code> element which excludes the <code>ContactController<\/code> if the <code>EnableContactInfo<\/code> parameter is set to false. This is a simple condition, but we can build complex logic using operators like <code>&amp;&amp;<\/code>, <code>||<\/code>, <code>!<\/code>, <code>&lt;<\/code>,<code>&gt;<\/code>, <code>=<\/code>, etc. if required.<\/p>\n<p>Now let&#8217;s uninstall and install the template for reflecting it with the latest changes.<\/p>\n<p>After that, let&#8217;s create a new project using the template:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">dotnet new codemazeapi -n MyFinalAPI --domain code-maze.com --EnableContactInfo true<\/pre>\n<p>Note that we set the <code>EnableContactInfo<\/code> argument to <code>true<\/code>. This will create the project with two controllers. Additionally, we can see that the <code>ValuesController<\/code> has two endpoint methods.<\/p>\n<p>However, If we set the <code>EnableContactInfo<\/code>\u00a0 to <code>false<\/code> while creating the project, it will generate a project with just one controller and the <code>ValuesController<\/code> will have just one endpoint method.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, we have learned how to build a custom .NET template and create projects out of it. Additionally, we have discussed customizing the template further by introducing parameters and optional contents.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we are going to talk about creating .NET Project Templates. Let&#8217;s get started. What are .NET Project Templates?\u00a0\u00a0 We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code. The .NET SDK comes with a set of default templates to cover [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":62191,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[12],"tags":[22,979,980],"class_list":["post-61595","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-net-core","tag-net-custom-templates","tag-project-templates","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating .NET Project Templates - Code Maze<\/title>\n<meta name=\"description\" content=\"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating .NET Project Templates - Code Maze\" \/>\n<meta property=\"og:description\" content=\"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-29T07:00:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-15T18:08:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Muhammed Saleem\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Muhammed Saleem\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\"},\"author\":{\"name\":\"Muhammed Saleem\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/590295cbd99c624d65d15016edeefaf2\"},\"headline\":\"Creating .NET Project Templates\",\"datePublished\":\"2021-12-29T07:00:36+00:00\",\"dateModified\":\"2022-01-15T18:08:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\"},\"wordCount\":1733,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png\",\"keywords\":[\".NET CORE\",\".NET Custom Templates\",\"Project Templates\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\",\"url\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\",\"name\":\"Creating .NET Project Templates - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png\",\"datePublished\":\"2021-12-29T07:00:36+00:00\",\"dateModified\":\"2022-01-15T18:08:44+00:00\",\"description\":\"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png\",\"width\":1100,\"height\":620,\"caption\":\".NET (Core)\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating .NET Project Templates\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/590295cbd99c624d65d15016edeefaf2\",\"name\":\"Muhammed Saleem\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/01\/Muhammed-Saleem-400-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/01\/Muhammed-Saleem-400-150x150.png\",\"caption\":\"Muhammed Saleem\"},\"description\":\"Muhammed Saleem has 16 years of proven track record in architecting, designing &amp; developing high-quality software solutions. He's a problem solver at heart and passionate about building great software. He's a curious, self-driven learner and self-starter with a strong base of computer science fundamentals. He has experience in implementing best practices for managing software development, ensuring code quality, Application Lifecycle Management, DevOps, etc.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/muhammedsaleem\/\"],\"url\":\"https:\/\/code-maze.com\/author\/muhammed-saleem\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating .NET Project Templates - Code Maze","description":"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/","og_locale":"en_US","og_type":"article","og_title":"Creating .NET Project Templates - Code Maze","og_description":"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code","og_url":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/","og_site_name":"Code Maze","article_published_time":"2021-12-29T07:00:36+00:00","article_modified_time":"2022-01-15T18:08:44+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png","type":"image\/png"}],"author":"Muhammed Saleem","twitter_card":"summary_large_image","twitter_creator":"@CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Muhammed Saleem","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/"},"author":{"name":"Muhammed Saleem","@id":"https:\/\/code-maze.com\/#\/schema\/person\/590295cbd99c624d65d15016edeefaf2"},"headline":"Creating .NET Project Templates","datePublished":"2021-12-29T07:00:36+00:00","dateModified":"2022-01-15T18:08:44+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/"},"wordCount":1733,"commentCount":5,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png","keywords":[".NET CORE",".NET Custom Templates","Project Templates"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/dotnet-project-templates-creation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/","url":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/","name":"Creating .NET Project Templates - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png","datePublished":"2021-12-29T07:00:36+00:00","dateModified":"2022-01-15T18:08:44+00:00","description":"We can use .NET Project templates to create ready-to-run projects that make it easy to start with a working set of code","breadcrumb":{"@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/dotnet-project-templates-creation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-dotnet-core.png","width":1100,"height":620,"caption":".NET (Core)"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/dotnet-project-templates-creation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"Creating .NET Project Templates"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]},{"@type":"Person","@id":"https:\/\/code-maze.com\/#\/schema\/person\/590295cbd99c624d65d15016edeefaf2","name":"Muhammed Saleem","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/01\/Muhammed-Saleem-400-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/01\/Muhammed-Saleem-400-150x150.png","caption":"Muhammed Saleem"},"description":"Muhammed Saleem has 16 years of proven track record in architecting, designing &amp; developing high-quality software solutions. He's a problem solver at heart and passionate about building great software. He's a curious, self-driven learner and self-starter with a strong base of computer science fundamentals. He has experience in implementing best practices for managing software development, ensuring code quality, Application Lifecycle Management, DevOps, etc.","sameAs":["https:\/\/www.linkedin.com\/in\/muhammedsaleem\/"],"url":"https:\/\/code-maze.com\/author\/muhammed-saleem\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/61595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=61595"}],"version-history":[{"count":6,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/61595\/revisions"}],"predecessor-version":[{"id":63779,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/61595\/revisions\/63779"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/62191"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=61595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=61595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=61595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}