Skip to content

Update PostAction with symbol parameters to cmd file arguments #1600

Closed
@abhisheksaxena741

Description

@abhisheksaxena741

I need to pass symbols parameters to args when executing setup.cmd file using postActions property as below .template.config file.

Here, i am passing two symbols of type string jsonFileNamePath and myfilename as arguments to setup.cmd.

{
  "$schema": "http://json.schemastore.org/template",
  "identity": "SampleTemplate",
  "groupIdentity": "SampleTemplate",
  "author": "Abhishek",
  "classifications": ["api", "apiswagger"],
  "name": "Sample Template",
  "shortName": "SampleTemplate",
  "tags": {
    "language": "C#"
  },
  "sourceName": "SampleTemplate",
  "primaryOutputs": [
	{
		"path": "SampleTemplate.csproj"
	}
  ],
  "guids": [
    "98048C9C-BF28-46BA-A98E-63767EE5E3A8",
    "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
  ],
  "symbols": {
    "skipRestore": {
      "type": "parameter",
      "datatype": "bool",
      "description": "Skips the execution of 'dotnet restore' on project creation.",
      "defaultValue": "false"
    },
    "jsonFileNamePath": {
      "type": "parameter",
      "datatype": "string",
      "description": "Path of the json file ",
      "defaultValue": "myjson.json",
	  "isRequired" : "true"
    },
    "myfilename": {
      "type": "parameter",
      "datatype": "string",
      "description": "Name of the json file ",
      "defaultValue": "myjson",
	  "isRequired" : "true"
    }
  },
  "postActions": [
    {
      "condition": "(!skipRestore)",
      "description": "Restore NuGet packages required by this project.",
      "manualInstructions": [
        { "text": "Run 'dotnet restore'" }
      ],
      "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
      "continueOnError": true
    },
	{
    "actionId": "3A7C4B45-1F5D-4A30-959A-51B88E82B5D2",
    "args": {
      "executable": "setup.cmd",
      "args": "jsonFileNamePath myfilename"
    },
    "manualInstructions": [{ 
       "text": "Run 'setup.cmd jsonFileNamePath myfilename'" 
       }],
    "continueOnError": "false",
    "description ": "setups the project by calling setup.cmd"
  }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Iteration:2023AprilfeatureThe issue defines new feature.size:2.0triagedThe issue was evaluated by the triage team, placed on correct area, next action defined.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions