-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[templates] add ide.host.json
files
#7349
Conversation
Fixes: dotnet#7315 This makes our item templates useable from inside Visual Studio, as it should allow them to show up in a new `Android` category in the "Add New Item" dialog.
@jonpryor a few questions on this one:
They also require the |
The answer to all these is "no":
I manually tested by downloading
Next edit "Microsoft.Android.Templates": {
"kind": "template",
"version": "33.0.0-ci.pr.gh7349.163"
} Create a new Then in a MAUI app: |
After working on dotnet#7349, I found some really odd behavior if you name an Android layout, `my_cool_layout.xml`. VS appears to generate: <?xml version="1.0" encoding="utf-8"?> <Linearmy_cool_layout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:my_cool_layout_width="match_parent" android:my_cool_layout_height="match_parent"> </Linearmy_cool_layout> This is completely broken! It appears that anywhere the word `Layout` was replaced with `my_cool_layout`. I also get the same behavior with `dotnet new android-layout -n my_cool_layout`. To solve this issue, I made the default name `Layout1`, so that `<LinearLayout/>` and `android:layout_width`, are not replaced. Now I get a `my_cool_layout.xml` with the contents: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout> Secondly, the `android-activity` template if you run: dotnet new android-activity -n MyActivity It will generate: [Activity(Label = "@string/app_name", MainLauncher = true)] public class MyActivity : Activity Let's replace the label with the name passed in, and remove `MainLauncher=true`, so we instead get: [Activity(Label = "MyActivity")] public class MyActivity : Activity I think this will prevent confusion with multiple app launchers, etc.
@mrward: would you be able to take a look at this? |
Looks mostly fine to me. The layout file seems to be flagged as C#. But that seems to match what is in the template.json file: |
Hmm, even the MAUI "page" templates that are So we should change this to |
For some reason I added a check to VS Mac that ignored every item template that was not C# language (I think I copied what WebTools was doing but will have to check). So for now I suggest it is left as C#. |
After working on #7349, I found some really odd behavior if you name an Android layout, `my_cool_layout.xml`. VS appears to generate: <?xml version="1.0" encoding="utf-8"?> <Linearmy_cool_layout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:my_cool_layout_width="match_parent" android:my_cool_layout_height="match_parent"> </Linearmy_cool_layout> This is completely broken! It appears that anywhere the word `Layout` was replaced with `my_cool_layout`. I also get the same behavior with `dotnet new android-layout -n my_cool_layout`. To solve this issue, I made the default name `Layout1`, so that `<LinearLayout/>` and `android:layout_width`, are not replaced. Now I get a `my_cool_layout.xml` with the contents: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> </LinearLayout> Secondly, the `android-activity` template if you run: dotnet new android-activity -n MyActivity It will generate: [Activity(Label = "@string/app_name", MainLauncher = true)] public class MyActivity : Activity Let's replace the label with the name passed in, and remove `MainLauncher=true`, so we instead get: [Activity(Label = "MyActivity")] public class MyActivity : Activity I think this will prevent confusion with multiple app launchers, etc.
* main: [templates] fix broken/wrong item template contents (dotnet#7366) [tests] export $DOTNET_gcServer as 0 (dotnet#7363) [templates] add `ide.host.json` files (dotnet#7349)
Fixes: #7315
Fixes: #7231
This makes our item templates useable from inside Visual Studio, as it should allow them to show up in a new
Android
category in the "Add New Item" dialog.