sayedihashimi / template-sample

Other
232 stars 54 forks source link

Template creates empty solution #78

Open khal0j opened 1 day ago

khal0j commented 1 day ago

I do not know exactly what I have changed but my template was working just fine until it was not. Right now what it does is it always creates two solutions, one is the exact copy of what I have in my template and an empty one (which it opens), however, the source files are not copied whatsoever, and I really cannot pinpoint the root cause of this issue.

Solution template, 3 projects.

Solution name : NugetPackageTemplate Project names : NugetPackageTemplate, NugetPackageTemplate.Tests, DemoConsoleApp

template.json :

{
  "$schema": "http://json.schemastore.org/template",
  "author": "authorName",
  "classifications": [ "DESKTOP", "Solution", "departmentName" ],
  "name": "NuGet Package",
  "shortName": "custnuget",
  "defaultName": "MyNugetPackage",
  "identity": "Infineon.Templates.CSharp",
  "description": "This is a template for creating NuGets following departmentName Conventions.",
  "tags": {
    "language": "C#",
    "type": "solution",
    "editorTreatAs": "solution"
  },
  "sourceName": "NugetPackage",
  "preferNameDirectory": true,
  "guids": [
    "2355D869-0117-451C-990A-5CDAA69D18C8",
    "6DCA3064-C4B2-4551-9B30-1DBC789B3CE2",
    "EC9C54C0-F951-4F15-9493-31EFE98E1F83"
  ],
  "symbols": {
    "Framework": {
      "type": "parameter",
      "description": "The target framework for the project.",
      "datatype": "choice",
      "choices": [
        {
          "choice": "net8.0",
          "description": "Target net8.0"
        }
      ],
      "replaces": "net8.0",
      "defaultValue": "net8.0"
    },
    "ProjectType": {
      "type": "parameter",
      "dataType": "choice",
      "choices": [
        {
          "choice": "Exe",
          "description": "Executable"
        },
        {
          "choice": "Library",
          "description": "DLL"
        }
      ],
      "displayName": "Project type",
      "replaces": "outputType",
      "defaultValue": "Library"
    },
    "IsExecutable": {
      "type": "computed",
      "datatype": "bool",
      "value": "(ProjectType == \"Exe\")"
    }
  },
  "sources": [
    {
      "modifiers": [
        {
          "condition": "(!IsExecutable)",
          "exclude": "NugetPackageTemplate/Startup.cs"
        }
      ]
    }
  ]
}

ide.host.json :

{
  "$schema": "http://json.schemastore.org/vs-2017.3.host",
  "icon": "logo.png",
  "symbolInfo": [
    {
      "id": "ProjectType",
      "isVisible": true,
      "defaultValue": "Library",
      "choices": [
        {
          "id": "Exe",
          "name": {
            "text": "Executable"
          }
        },
        {
          "id": "Library",
          "name": {
            "text": "DLL"
          }
        }
      ]
    }
  ]
}

Created project : image

sayedihashimi commented 1 day ago

Have you followed all the guidance regarding solution templates in the README here? Can you share the template so I can try it out?