Stylet.Templates: target .NET 5, and give an option to target .NET Core 3.1

This commit is contained in:
Antony Male 2020-11-28 12:54:50 +00:00
parent 26d905c6f0
commit e56eadca21
7 changed files with 78 additions and 33 deletions

View File

@ -21,7 +21,36 @@ It is inspired by [Caliburn.Micro](http://caliburnmicro.com/), and shares many o
Getting Started
---------------
### .NET Framework
### .NET 5.0+ / .NET Core
For .NET Core and .NET 5.0+ projects, the quickest way to get started is by using `dotnet new` with Stylet's template.
Open a command window where you want to create your new project, and install the Stylet templates using:
```
dotnet new -i Stylet.Templates
```
Then create a new .NET 5.0 project with:
```
dotnet new stylet -n MyStyletProject
```
(changing `MyStyletProject` as appropriate).
If you want to create a .NET Core 3.1 project, then:
```
dotnet new stylet -F netcoreapp3.1 -n MyStyletProject
```
If you want to set up your project manually, install the [Stylet](https://www.nuget.org/packages/Stylet) package, then follow the instructions in the [Quick Start](https://github.com/canton7/Stylet/wiki/Quick-Start).
Stylet requires .NET 5.0+ or .NET Core 3.0+.
### .NET Framework (<= .NET 4)
For .NET Framework projects, the quickest way to get started is to create a new "WPF Application" project, then install the NuGet package [Stylet.Start](https://www.nuget.org/packages/Stylet.Start).
This will install Stylet, and set up a simple skeleton project.
@ -32,28 +61,6 @@ If you want to set up your project manually, install the [Stylet](https://www.nu
Stylet requires .NET 4.5 (Visual Studio 2012 or higher).
### .NET Core
For .NET Core projects, the quickest way to get started is by using `dotnet new` with Stylet's template.
Open a command window where you want to create your new project, and install the Stylet templates using:
```
dotnet new -i Stylet.Templates
```
Then create a new project with:
```
dotnet new stylet -o MyStyletProject
```
(changing `MyStyletProject` as appropriate).
If you want to set up your project manually, install the [Stylet](https://www.nuget.org/packages/Stylet) package, then follow the instructions in the [Quick Start](https://github.com/canton7/Stylet/wiki/Quick-Start).
Stylet requires .NET Core 3.0.
Documentation
-------------

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageType>Template</PackageType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWpf>true</UseWpf>
<IncludeContentInPack>true</IncludeContentInPack>

View File

@ -12,5 +12,43 @@
},
"sourceName": "Company.StyletApplication1",
"preferNameDirectory": true,
"defaultName": "StyletApp1"
"defaultName": "StyletApp1",
"symbols": {
"Framework": {
"type": "parameter",
"description": "The target framework for the project",
"datatype": "choice",
"choices": [
{
"choice": "net5.0-windows",
"description": "Target .NET 5.0"
},
{
"choice": "netcoreapp3.1",
"description": "Target .NET Core 3.1"
}
],
"replaces": "net5.0-windows",
"defaultValue": "net5.0-windows"
},
"SDK": {
"type": "generated",
"generator": "switch",
"parameters": {
"evaluator": "C++",
"datatype": "string",
"cases": [
{
"condition": "((Framework == 'netcoreapp3.0') || (Framework == 'netcoreapp3.1'))",
"value": "Microsoft.NET.Sdk.WindowsDesktop",
},
{
"condition": "(true)",
"value": "Microsoft.NET.Sdk"
}
]
},
"replaces": "Microsoft.NET.Sdk"
}
}
}

View File

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:Company.WpfApplication1">
xmlns:local="clr-namespace:Company.StyletApplication1">
<Application.Resources>
<s:ApplicationLoader>
<s:ApplicationLoader.Bootstrapper>

View File

@ -1,4 +1,4 @@
using Company.WpfApplication1.Pages;
using Company.StyletApplication1.Pages;
using Stylet;
using StyletIoC;

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Company.StyletApplication1</RootNamespace>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>Company.StyletApplication1</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Stylet" Version="1.*" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:Company.WpfApplication1.Pages"
xmlns:local="clr-namespace:Company.StyletApplication1.Pages"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
Title="Stylet Project" Height="450" Width="800">