ligershark / sidewafflev2

Other
30 stars 11 forks source link

Question: How can I rename specific files in template.json? #32

Open FlavioKrahl opened 6 years ago

FlavioKrahl commented 6 years ago

@sayedihashimi I saw your answer to a similar question at https://github.com/dotnet/templating/issues/396. However I am not able to edit my template.json the way that is suggested in that issue. Is there something I am missing if I'm using the SideWaffle Creator or is that attribute for symbols simply not supported in this version? Thanks for the help in advance. Greets Flavio

edit: To precise my question a bit, is it generally possible to add replacement parameters with custom values to a custom Wizard and have them replaced with user input? Because I can't seem to find a way to get this done with the Sidewaffle Creator. feelsBad

sayedihashimi commented 6 years ago

I'm not really following your question completly, but I think the following may help you https://github.com/ligershark/sidewafflev2/issues/17#issuecomment-327677764. If not can you describe what you're trying to do in more detail?

FlavioKrahl commented 6 years ago

Okay I tried the approach mentioned in the issue you linked me to, but it doesn't exactly do what I'm trying to achieve. Let's say I have a Class "Module1.cs" and want to rename this file based on user input. In my custom Wizard I have following line of code in the RunStarted Method:

replacementDictionary.Add("passthrough:ModuleName", WizardForm.MyModuleName.Text)

In my template.json I added following symbol:

"symbols": {
    "ModuleName": {
      "type": "parameter",
      "datatype": "string",
      "replaces": "Module1",
      "fileRename:" :"Module1",
      "defaultValue": "MyModuleName"
    }
 }

However, my file "Module1.cs" is not renamed to "MyModuleName.cs" outside of the solution (in folder) or whatever else user input I give the custom wizard. It always keeps it's old name and the solution created with the template throws "file not found" after project creation, no matter what I do.