-
Notifications
You must be signed in to change notification settings - Fork 520
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
.NET 6 templates for iOS, macOS, tvOS, & MacCatalyst #10741
Conversation
dotnet/Microsoft.MacCatalyst.Templates/maccatalyst/MacCatalystApp1.csproj
Show resolved
Hide resolved
public class Application | ||
{ | ||
// This is the main entry point of the application. | ||
static void Main(string[] args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do template code need to use a specific coding style? Or will they be reformatted according to the user's settings when they're instantiated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a dotnet format
tool: https://www.hanselman.com/blog/editorconfig-code-formatting-from-the-command-line-with-net-cores-dotnet-format-global-tool
I tested this, I copied the .editorconfig
from xamarin-android, then did:
% dotnet new ios
% dotnet format
When I saw other templates, they all use VS Windows coding style -- but I guess it could really be any style? I think dotnet format
would fix up anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That tools looks pretty amazing!
Its mere existence makes me vote towards having the templates use our own coding style (in which case the coding style is wrong in some of the new files - I guess you could run dotnet format
locally in the template directory and that'll fix it 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it compare with what we ship today ? https://github.com/xamarin/xamarin-templates
This should not fix (close) the dotnet issue until the work is completed (or we risk losing track of the task)
dotnet/Microsoft.MacCatalyst.Templates/maccatalyst/.template.config/template.json
Show resolved
Hide resolved
dotnet/Microsoft.MacCatalyst.Templates/maccatalyst/.template.config/template.json
Show resolved
Hide resolved
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) | ||
{ | ||
// create a new window instance based on the screen size | ||
Window = new UIWindow(UIScreen.MainScreen.Bounds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source code format is inconsistent, e.g. space before (
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I dotnet format
every template to use default VS settings?
Or should I dotnet format
using the .editorconfig
in xamarin-macios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as much as I'd like to use our (mono) style it's likely best to follow VS[4m] style used for other templates
@spouliot I got these files from here ^^ I should have put that in the commit message. I didn't change anything (intentionally) other than port them to .NET 6. For the Mac template I created a new project in latest VS Mac -- I didn't find a Mac template in xamarin-templates. |
Context: https://docs.microsoft.com/dotnet/core/tutorials/cli-templates-create-template-pack Context: https://github.com/dotnet/templating/wiki Context: dotnet/designs#120 Fixes: xamarin#10252 To implement templates in a .NET workload: 1. Make `.nupkg` files that follow the structure of the `dotnet new` templating system, using `$(PackageType)` of `Template`. 2. Install the `.nupkg` files in in `dotnet/template-packs/` 3. Update `WorkloadManifest.json`, to be part of the workload: "Microsoft.@platform@.Templates": { "kind": "template", "version": "@Version@" } These are a starting point, for what I would consider the minimum for the xamarin-macios repo to provide for now: Template Name Short Name Language Tags -------------------------------------------- -------------- ---------- ---------------------- iOS Controller template ios-controller [C#] iOS iOS Application ios [C#] iOS iOS Class library ioslib [C#] iOS macOS Application macos [C#] macOS MacCatalyst Application maccatalyst [C#] macOS/Catalyst tvOS Application tvos [C#] tvOS We will probably need PM input on what the final templates will be. To use these, you might do: $ mkdir MyApp && cd MyApp $ dotnet new ios $ dotnet new ios-controller --name LoginController --namespace MyApp Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
acbc7c7
to
4614f6c
Compare
Latest changes:
Template Name Short Name Language Tags
-------------------------------------------- -------------- ---------- ----------------------
iOS Controller template ios-controller [C#] iOS
iOS Application ios [C#] iOS
iOS Class library ioslib [C#] iOS
macOS Application macos [C#] macOS
MacCatalyst Application maccatalyst [C#] macOS/Catalyst
tvOS Application tvos [C#] tvOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Context: https://docs.microsoft.com/dotnet/core/tutorials/cli-templates-create-template-pack
Context: https://github.com/dotnet/templating/wiki
Context: dotnet/designs#120
Fixes: #10252
To implement templates in a .NET workload:
.nupkg
files that follow the structure of thedotnet new
templating system, using
$(PackageType)
ofTemplate
..nupkg
files in indotnet/template-packs/
WorkloadManifest.json
, to be part of the workload:These are a starting point, for what I would consider the minimum for
the xamarin-macios repo to provide for now:
We will probably need PM input on what the final templates will be.
To use these, you might do: