maui
maui copied to clipboard
[templates] Fix applicationId template option
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 very nice! Can you confirm what happens with:
dotnet new mauidotnet 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?
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
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 :)