Skip to content
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

Android Items Template is missing for .Net Android project #7231

Closed
hamiddd1980 opened this issue Aug 4, 2022 · 6 comments · Fixed by #7349
Closed

Android Items Template is missing for .Net Android project #7231

hamiddd1980 opened this issue Aug 4, 2022 · 6 comments · Fixed by #7349
Assignees
Labels
Area: Templates Issues with templates shipped with the Android workload. bug Component does not function as intended.

Comments

@hamiddd1980
Copy link

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

Android 6, Android 9

Description

Currently in .Net Android project, the template for Android specific items(files) like Activity,Layout,Menu …is missing from menu : Resource Folder>Add>New Item.
These items are available in Xamarin.Android , but are not implemented in new .Net Android.
Without Android Items Template in .Net Android, it’s so difficult to develop Android Apps in VS.
Request:
Please add Android Files Templates (Like Activity,Layout,…) to .Net Android projects like Xamarin.Android.

Steps to Reproduce

1-Create a new .Net Android project
2-Try to add a new Android item(file) like Layout,Activity... to the project by right click on project items.

Did you find any workaround?

No response

Relevant log output

No response

@hamiddd1980 hamiddd1980 added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Aug 4, 2022
@dellis1972 dellis1972 removed the needs-triage Issues that need to be assigned. label Aug 4, 2022
@dellis1972
Copy link
Contributor

Hmm, our template pack for .net 6 does include Activity and Layout Item Templates. Namely android-activity and android-layout (see https://github.com/xamarin/xamarin-android/tree/main/src/Microsoft.Android.Templates).

So I wonder why they do not show up in the IDE.

@tondat are you aware of any issues with Item Templates not showing up in Visual Studio?

@hamiddd1980
Copy link
Author

hamiddd1980 commented Aug 10, 2022

Hi @dellis1972 . is it possible that I add .Net Android templates to Visual Studio manually? (where should I copy those files?)
Thank you.

@jonathanpeppers
Copy link
Member

You should be able to use dotnet new android and then just open the template in Visual Studio.

https://docs.microsoft.com/dotnet/core/tools/dotnet-new

@dellis1972
Copy link
Contributor

@jonathanpeppers its the Item Templates they are after, not a new project one.

I'm not sure how to go about getting those to show up in VS.

@jonathanpeppers
Copy link
Member

Ah yes, the item template should also work:

https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNet.md#dotnet-new

So like:

dotnet new android-activity --name LoginActivity --namespace MyAndroidApp

@hamiddd1980
Copy link
Author

but I'm looking for .Net Android specific templates(layout,Activity ...)
androidmissing

@jpobst jpobst added Area: Templates Issues with templates shipped with the Android workload. and removed Area: App+Library Build Issues when building Library projects or Application projects. labels Sep 6, 2022
@jpobst jpobst added this to the .NET 7 milestone Sep 6, 2022
@jpobst jpobst added the bug Component does not function as intended. label Sep 6, 2022
jonpryor pushed a commit that referenced this issue Sep 12, 2022
Fixes: #7231
Fixes: #7315

This makes our item templates useable from inside Visual Studio; it
allows them to show up in a new `Android` category in the
"Add New Item" dialog.

![Add New Item dialog on Windows][0]
![Add New File dialog on macOS][1]

[0]: https://user-images.githubusercontent.com/840039/188975443-7c10c5fc-c106-46ca-8884-46c38cf7b6a3.png
[1]: https://user-images.githubusercontent.com/372361/189409441-aebe1591-8856-4fbe-90c6-425f29eea8bf.png
@ghost ghost locked as resolved and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Templates Issues with templates shipped with the Android workload. bug Component does not function as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants