Skip to content

Commit

Permalink
Merge pull request unoplatform#4504 from unoplatform/dev/jela/dotnet-…
Browse files Browse the repository at this point in the history
…new-template

Update dotnet new templates
  • Loading branch information
jeromelaban authored Nov 14, 2020
2 parents 6575a3c + 55a41ff commit acc3463
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 125 deletions.
56 changes: 39 additions & 17 deletions doc/articles/get-started-vsmac.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,56 @@
While it is easier to create apps using Uno on Windows, you can also create all but UWP apps on your Mac.

## Prerequisites
* [**Visual Studio for Mac**](https://visualstudio.microsoft.com/vs/mac/)
* [**Visual Studio for Mac 8.8**](https://visualstudio.microsoft.com/vs/mac/)
* [**Xcode**](https://apps.apple.com/us/app/xcode/id497799835?mt=12) 10.0 or higher
* An [**Apple ID**](https://support.apple.com/en-us/HT204316)
* .NET Core 3.1

## Modifying Existing Uno App

1. Open project in Visual Studio for Mac
![new-project](Assets/quick-start/vs-mac-open-project.png)
Once open, you should see your folder structure set up like this:
* [.NET Core SDK 3.1](https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.404-macos-x64-installer)
* [**GTK+3**](https://formulae.brew.sh/formula/gtk+3) for running the Skia/GTK projects

## Installing the dotnet new templates
- In order to create a new Uno Project, you'll need to install the [`dotnet new` Uno Platform templates](get-started-dotnet-new.md).
- Once done, in Visual Studio for Mac, open the preference menu:
- On left side, open the **Other** then **Preview Features** menu
- Check the **Show all .NET Core templates in the New Project dialog**

## Create a new project using the IDE
1. To create a new project:
- Click the **New** button on the welcome screen
- Select **Cross Platform App (Uno Platform)**
- If presented with a list of options, uncheck **Skia/WPF**
- Choose a name then click create

1. Once created, you should see your folder structure set up like this:
![folder-structure](Assets/quick-start/vs-mac-folder-structure.png)\
If you have a warning symbol on your iOS project, make sure you have the minimum version of XCode.
- If you have a warning symbol on your iOS project, make sure you have the minimum version of Xcode installed.
![update-xcode](Assets/quick-start/xcode-version-warning.jpg)\
To update, go to `Visual Studio > Preferences > Projects > SDK Locations > Apple` and select XCode 10.0 or higher.
To update, go to `Visual Studio > Preferences > Projects > SDK Locations > Apple` and select Xcode 12 or higher.
Restart Visual Studio.

2. You can now run on iOS, Android, and WebAssembly by setting your startup project and running.
1. If you did not get presented a list of options to create the project, as of Visual Studio for Mac 8.8, the Uno Platform template contains WPF projects that prevent NuGet restore to work properly. To fix this:
- Select the `MyProject.Skia.Wpf` and `MyProject.Skia.Wpf.Host`
- Right click to remove them from the solution.
- At the top of the tree, on the solution node, right click and select **Restore Nuget Packages**
1. You can now run on iOS, Android, and macOS by setting your startup project and running.
![startup-projects](Assets/quick-start/vs-mac-build.png)

Note: You will not be able to build the UWP project on a Mac. All changes to this project must be made on Windows.
Note: You will not be able to build the UWP and WPF projects on a Mac. All changes to this project must be made on Windows.

## Create a new project using the command line

You can create a new Uno Platfom solution with the following terminal command:
```bash
dotnet new unoapp -o MyProject --skia-wpf=false
```
Once created, you can open it using the Visual Studio IDE.


### Build for WASM
### Build and Run for WebAssembly

Building for WebAssembly takes a few more steps than iOS and Android:
Building for WebAssembly takes a few more steps:

1. Set yourProject.Wasm to startup project
1. Set `MyProject.Wasm` to startup project
2. Build the project
3. In the terminal, navigate to your build output. This will typically be: `yourProject.Wasm > bin > Debug > netstandard2.0 > dist > server.py` Run the `server.py` program.
3. In the terminal, navigate to your build output. This will typically be: `MyProject.Wasm > bin > Debug > netstandard2.0 > dist > server.py` Run the `server.py` program.
4. In your browser, open localhost:8000.

### Video Tutorial
Expand Down
3 changes: 2 additions & 1 deletion doc/articles/get-started-wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ Unhandled exception. System.TypeInitializationException: The type initializer fo
```

On Windows, you will need to install the [GTK+3 runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases). **Make sure to restart Visual Studio** for the changes to be used by Visual Studio.
On Linux, you'll need to follow the [Uno Platform](https://github.com/unoplatform/uno/blob/master/doc/articles/get-started-with-linux.md#setting-up-for-linux) setup instructions.
On Linux, you'll need to follow the [Uno Platform](get-started-with-linux.md#setting-up-for-linux) setup instructions.
On macOS, you'll need to follow the [Uno Platform](get-started-with-vsmac.md) setup instructions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"macOS": {
"longName": "macos",
"shortName": "macos"
},
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"$schema": "http://json.schemastore.org/template",
"author": "Uno Platform",
"classifications": [ "Prism", "Xamarin", "Uno Platform", "WebAssembly", "iOS", "Android", "WinUI", "UWP" ],
"name": "Prism Cross-Platform App (Uno Platform)",
"name": "Cross-Platform App (Prism)",
"identity": "Uno.Platform.Prism.CSharp", // Unique name for this template
"groupIdentity": "Uno.Platform.Prism",
"shortName": "unoapp-prism", // Short name that can be used on the cli
"description": "Solution template for creating a Prism Library enabled Cross-platform XAML app with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly, Skia/WPF, and Skia/GTK for Linux.",
"tags": {
"language": "C#",
"type": "project"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Cross-Platform App (Prism)"
},
"description": {
"text": "Solution template for creating a Prism Library enabled Cross-platform XAML app with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly."
},
"order": 610,
"icon": "uno-logo.png",
"learnMoreLink": "https://github.com/unoplatform/uno",
"uiFilters": [
"oneaspnet"
],
"additionalWizardParameters": {
"$isMultiProjectTemplate$": "true"
},
"symbolInfo": [
{
"id": "UWP",
"name": {
"text": "Add support for UWP"
},
"isVisible": "true"
},
{
"id": "iOS",
"name": {
"text": "Add support for iOS"
},
"isVisible": "true"
},
{
"id": "Android",
"name": {
"text": "Add support for Android"
},
"isVisible": "true"
},
{
"id": "macOS",
"name": {
"text": "Add support for macOS"
},
"isVisible": "true"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"macOS",
"WinUI"
],
"name": "Cross-Platform App (WinUI, Uno Platform)",
"name": "Cross-Platform App (WinUI)",
"identity": "Uno.Platform.UnoApp.WinUI",
"groupIdentity": "Uno.Platform.Blank.WinUI",
"description": "Solution template for creating a cross-platform XAML app with the Uno Platform that targets WinUI 3 for UWP, Android, iOS, macOS, and WebAssembly.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Uno WebAssembly App (WinUI)",
"id": "1060"
"text": "Cross-Platform App (WinUI)",
},
"description": {
"text": "A project template for creating rich Cross Platform app",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1051"
"text": "A project template for creating rich Cross Platform app using WinUI 3",
},
"order": 610,
"icon": "uno-logo.png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@
"longName": "macos",
"shortName": "macos"
},
"skia-wpf": {
"longName": "skia-wpf",
"shortName": "skia-wpf"
},
"skia-gtk": {
"longName": "skia-gtk",
"shortName": "skia-gtk"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Linux",
"Tizen"
],
"name": "Cross-Platform App (Uno Platform)",
"name": "Cross-Platform App",
"identity": "Uno.Platform.UnoApp",
"groupIdentity": "Uno.Platform.Blank",
"description": "Solution template for creating a cross-platform XAML app with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly, Skia/WPF, and Skia/GTK for Linux.",
Expand Down Expand Up @@ -169,16 +169,17 @@
},
{
"condition": "skia-wpf",
"path": "UnoQuickStart.Skia.WPF\\UnoQuickStart.Skia.WPF.csproj"
"path": "UnoQuickStart.Skia.WPF\\UnoQuickStart.Skia.Wpf.csproj"
},
{
"condition": "skia-wpf",
"path": "UnoQuickStart.Skia.WPF.Host\\UnoQuickStart.Skia.WPF.Host.csproj"
"path": "UnoQuickStart.Skia.WPF.Host\\UnoQuickStart.Skia.Wpf.Host.csproj"
},
{
"condition": "skia-tizen",
"path": "UnoQuickStart.Skia.Tizen\\UnoQuickStart.Skia.Tizen.csproj"
}

],
"sources": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Cross-Platform App (Uno Platform)",
"id": "1060"
"text": "Cross-Platform App",
},
"description": {
"text": "Solution template for creating a cross-platform XAML app with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly, Skia/WPF, and Skia/GTK for Linux.",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1051"
},
"order": 610,
"icon": "uno-logo.png",
Expand All @@ -19,24 +16,10 @@
"$isMultiProjectTemplate$": "true"
},
"symbolInfo": [
{
"id": "windowsPublisherName",
"name": {
"text": "Provides the value to use for the Windows head publisher"
},
"isVisible": "true"
},
{
"id": "WebAssembly",
"name": {
"text": "Enables the WebAssembly platform support project"
},
"isVisible": "true"
},
{
"id": "UWP",
"name": {
"text": "Add support for UWP"
"text": "Add support for WebAssembly"
},
"isVisible": "true"
},
Expand All @@ -61,17 +44,24 @@
},
"isVisible": "true"
},
{
"id": "skia-gtk",
"name": {
"text": "Add support for Skia/GTK (Linux, macOS, Windows 7/10)"
},
"isVisible": "true"
},
{
"id": "skia-wpf",
"name": {
"text": "Enables the Skia/WPF platform support project"
"text": "Add support for Skia/WPF (Windows 7/10)"
},
"isVisible": "true"
},
{
"id": "skia-gtk",
"id": "UWP",
"name": {
"text": "Enables the Skia/GTK platform support project"
"text": "Add support for UWP"
},
"isVisible": "true"
},
Expand All @@ -81,6 +71,13 @@
"text": "Adds the Visual Studio Code Debugging support files for WebAssembly"
},
"isVisible": "false"
},
{
"id": "windowsPublisherName",
"name": {
"text": "Provides the value to use for the Windows head publisher"
},
"isVisible": "true"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Windows",
"macOS"
],
"name": "Cross-Runtime Library (Uno Platform)",
"name": "Cross-Runtime Library",
"identity": "Uno.Platform.UnoCrossRuntimeLib",
"groupIdentity": "Uno.Platform.BlankCrossRuntimeLib",
"description": "Solution template for creating a cross-runtime Uno Platform library that targets UWP, Android, iOS, macOS, and WebAssembly.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Uno WebAssembly App",
"id": "1060"
"text": "Cross-Runtime Library",
},
"description": {
"text": "A project template for creating rich Cross Platform app",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1051"
"text": "A project template for creating a Cross-Runtime Library",
},
"order": 610,
"icon": "uno-logo.png",
"learnMoreLink": "https://github.com/unoplatform/uno",
"uiFilters": [
"oneaspnet"
],
"additionalWizardParameters": {
"$isMultiProjectTemplate$": "true"
},
"symbolInfo": [
{
"id": "UWP",
"name": {
"text": "Add support for UWP"
},
"isVisible": "true"
},
{
"id": "iOS",
"name": {
"text": "Add support for iOS"
},
"isVisible": "true"
},
{
"id": "Android",
"name": {
"text": "Add support for Android"
},
"isVisible": "true"
},
{
"id": "macOS",
"name": {
"text": "Add support for macOS"
},
"isVisible": "true"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Windows",
"macOS"
],
"name": "Cross-Platform Library (Uno Platform)",
"name": "Cross-Platform Library",
"identity": "Uno.Platform.UnoLib",
"groupIdentity": "Uno.Platform.BlankLibrary",
"description": "Template for creating a cross-platform library with the Uno Platform that targets UWP, Android, iOS, macOS, WebAssembly and Skia.",
Expand Down
Loading

0 comments on commit acc3463

Please sign in to comment.