maui icon indicating copy to clipboard operation
maui copied to clipboard

[templates] Fix applicationId template option

Open jknaudt21 opened this issue 2 years ago • 2 comments
trafficstars

Description of Change

We prevent the templating engine from matching the AppID to the App's name (the sourceName). This allows the applicationId parameter to work as expected when doing dotnet new -ap com.my.name .

Issues Fixed

fixes #13297

jknaudt21 avatar Feb 23 '23 00:02 jknaudt21

@jknaudt21 very nice! Can you confirm what happens with:

  1. dotnet new maui
  2. dotnet new maui -o FooBar_Baz.Banana

I want to make sure that those cases are also handled reasonably well. Or will they just get the default value com.companyname.mauiapp unless it's explicitly set at project creation time?

Eilon avatar Feb 28 '23 18:02 Eilon

Hey @Eilon. Here are the results:

Case Result in Cproj
dotnet new maui <ApplicationId>com.companyname.mauiapp</ApplicationId>
dotnet new maui -o FooBar_Baz.Banana <ApplicationId>com.companyname.mauiapp</ApplicationId>

Regardless of the app name you'll always end up with the default value com.companyname.mauiapp unless explicitly stated using -ap. The templating engine can't really handle replacing a string linked to the project's name and then replacing the previous replacement with a another one

jknaudt21 avatar Feb 28 '23 20:02 jknaudt21

I'm looking into seeing if something can be done with a symbol generator. https://github.com/dotnet/templating/wiki/Available-Symbols-Generators.

Marking PR as a draft until I arrive at a conclusion.

Edit: a solution was found that is the best of both worlds :)

jknaudt21 avatar Mar 01 '23 22:03 jknaudt21