From d6c2f8e7df31cbcaa30e49f40946d2f21a55d78b Mon Sep 17 00:00:00 2001 From: Antony Male Date: Tue, 24 Sep 2019 14:51:33 +0100 Subject: [PATCH] Add a .NET Core template --- Rakefile | 14 ++++++++ Stylet.sln | 34 +++++++++++++++++++ Stylet/Stylet.csproj | 8 +++-- StyletTemplates/StyletTemplates.csproj | 28 +++++++++++++++ .../.template.config/template.json | 16 +++++++++ .../StyletApplication-CSharp/App.xaml | 13 +++++++ .../StyletApplication-CSharp/App.xaml.cs | 17 ++++++++++ .../StyletApplication-CSharp/Bootstrapper.cs | 19 +++++++++++ .../Company.StyletApplication1.csproj | 14 ++++++++ .../Pages/ShellView.xaml | 16 +++++++++ .../Pages/ShellView.xaml.cs | 15 ++++++++ .../Pages/ShellViewModel.cs | 8 +++++ global.json | 2 +- 13 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 StyletTemplates/StyletTemplates.csproj create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/.template.config/template.json create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/App.xaml create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/App.xaml.cs create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/Bootstrapper.cs create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/Company.StyletApplication1.csproj create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml.cs create mode 100644 StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellViewModel.cs diff --git a/Rakefile b/Rakefile index 2c946dd..2ff2b01 100644 --- a/Rakefile +++ b/Rakefile @@ -10,8 +10,11 @@ NUSPEC_START = 'NuGet/Stylet.start.nuspec' ASSEMBLY_INFO = 'Stylet/Properties/AssemblyInfo.cs' CSPROJ = 'Stylet/Stylet.csproj' +TEMPLATES_CSPROJ = 'StyletTemplates/StyletTemplates.csproj' UNIT_TESTS = 'StyletUnitTests/StyletUnitTests.csproj' +TEMPLATES_DIR = 'StyletTemplates/templates' + directory COVERAGE_DIR desc "Build the project using the current CONFIG (or Debug)" @@ -29,6 +32,7 @@ task :package do # Not sure why these have to be this way around, but they do sh 'dotnet', 'pack', '--no-build', '-c', CONFIG, CSPROJ, "-p:NuSpecFile=../#{NUSPEC_START}" sh 'dotnet', 'pack', '--no-build', '-c', CONFIG, CSPROJ + sh 'dotnet', 'pack', '-c', CONFIG, TEMPLATES_CSPROJ end desc "Bump version number" @@ -41,10 +45,20 @@ task :version, [:version] do |t, args| content[/(.+?)<\/VersionPrefix>/, 1] = version File.open(CSPROJ, 'w'){ |f| f.write(content) } + content = IO.read(TEMPLATES_CSPROJ) + content[/(.+?)<\/VersionPrefix>/, 1] = version + File.open(TEMPLATES_CSPROJ, 'w'){ |f| f.write(content) } + content = IO.read(NUSPEC_START) content[/(.+?)<\/version>/, 1] = args[:version] content[%r{}, 1] = args[:version] File.open(NUSPEC_START, 'w'){ |f| f.write(content) } + + Dir[File.join(TEMPLATES_DIR, '**/*.csproj')].each do |csproj| + content = IO.read(csproj) + content[//, 1] = version + File.open(csproj, 'w'){ |f| f.write(content) } + end end desc "Extract StyletIoC as a standalone file" diff --git a/Stylet.sln b/Stylet.sln index 2f1a693..aa0f2de 100644 --- a/Stylet.sln +++ b/Stylet.sln @@ -9,24 +9,58 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stylet", "Stylet\Stylet.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StyletIntegrationTests", "StyletIntegrationTests\StyletIntegrationTests.csproj", "{4122F924-6B71-4DDA-995E-FAF78242E20C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StyletTemplates", "StyletTemplates\StyletTemplates.csproj", "{A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Company.StyletApplication1", "StyletTemplates\templates\StyletApplication-CSharp\Company.StyletApplication1.csproj", "{182059BC-637B-465C-B812-70406FBDA9CC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Debug|x64.ActiveCfg = Debug|Any CPU + {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Debug|x64.Build.0 = Debug|Any CPU {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Release|Any CPU.ActiveCfg = Release|Any CPU {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Release|Any CPU.Build.0 = Release|Any CPU + {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Release|x64.ActiveCfg = Release|Any CPU + {13AFA20D-CCEA-4A58-920E-4D8816C7296B}.Release|x64.Build.0 = Release|Any CPU {895A0541-84CF-4D3D-9539-58F1FC286336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {895A0541-84CF-4D3D-9539-58F1FC286336}.Debug|Any CPU.Build.0 = Debug|Any CPU + {895A0541-84CF-4D3D-9539-58F1FC286336}.Debug|x64.ActiveCfg = Debug|Any CPU + {895A0541-84CF-4D3D-9539-58F1FC286336}.Debug|x64.Build.0 = Debug|Any CPU {895A0541-84CF-4D3D-9539-58F1FC286336}.Release|Any CPU.ActiveCfg = Release|Any CPU {895A0541-84CF-4D3D-9539-58F1FC286336}.Release|Any CPU.Build.0 = Release|Any CPU + {895A0541-84CF-4D3D-9539-58F1FC286336}.Release|x64.ActiveCfg = Release|Any CPU + {895A0541-84CF-4D3D-9539-58F1FC286336}.Release|x64.Build.0 = Release|Any CPU {4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|x64.ActiveCfg = Debug|Any CPU + {4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|x64.Build.0 = Debug|Any CPU {4122F924-6B71-4DDA-995E-FAF78242E20C}.Release|Any CPU.ActiveCfg = Release|Any CPU {4122F924-6B71-4DDA-995E-FAF78242E20C}.Release|Any CPU.Build.0 = Release|Any CPU + {4122F924-6B71-4DDA-995E-FAF78242E20C}.Release|x64.ActiveCfg = Release|Any CPU + {4122F924-6B71-4DDA-995E-FAF78242E20C}.Release|x64.Build.0 = Release|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Debug|x64.Build.0 = Debug|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Release|Any CPU.Build.0 = Release|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Release|x64.ActiveCfg = Release|Any CPU + {A8BD4AB7-6F0E-4CDA-B41B-E8A8104038B8}.Release|x64.Build.0 = Release|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Debug|x64.ActiveCfg = Debug|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Debug|x64.Build.0 = Debug|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Release|Any CPU.Build.0 = Release|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Release|x64.ActiveCfg = Release|Any CPU + {182059BC-637B-465C-B812-70406FBDA9CC}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Stylet/Stylet.csproj b/Stylet/Stylet.csproj index a83b2c0..9a38c65 100644 --- a/Stylet/Stylet.csproj +++ b/Stylet/Stylet.csproj @@ -14,7 +14,7 @@ 0.0.0 Stylet - WPF MVVM ViewModel Screen Conductor ViewModel-First Model-View-ViewModel UI + WPF;MVVM;ViewModel;Screen Conductor;ViewModel-First;Model-View-ViewModel;UI Copyright © 2014 Antony Male https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png http://github.com/canton7/Stylet @@ -22,7 +22,7 @@ git https://github.com/canton7/Stylet Antony Male - A very lightweight but powerful ViewModel-First MVVM framework for WPF, inspired by Caliburn.Micro. Comes with its own IoC container. + A very lightweight but powerful ViewModel-First MVVM framework for WPF, inspired by Caliburn.Micro. true true @@ -34,6 +34,10 @@ + + + + diff --git a/StyletTemplates/StyletTemplates.csproj b/StyletTemplates/StyletTemplates.csproj new file mode 100644 index 0000000..ad89c08 --- /dev/null +++ b/StyletTemplates/StyletTemplates.csproj @@ -0,0 +1,28 @@ + + + Template + netcoreapp3.0 + true + + true + false + content + + 0.0.0 + Stylet.Templates + dotnet-new;templates;WPF;MVVM;ViewModel;Screen;Conductor;ViewModel-First;Model-View-ViewModel;UI + Copyright © 2019 Antony Male + https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png + http://github.com/canton7/Stylet + MIT + git + https://github.com/canton7/Stylet + Antony Male + .NET Core templates for Stylet, the lightweight but powerful ViewModel-First MVVM framework for WPF, + + + + + + + diff --git a/StyletTemplates/templates/StyletApplication-CSharp/.template.config/template.json b/StyletTemplates/templates/StyletApplication-CSharp/.template.config/template.json new file mode 100644 index 0000000..5750583 --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/.template.config/template.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Antony Male", + "classifications": ["Common", "WPF", "MVVM", "Stylet"], + "name": "Stylet Application", + "description": "A project for creating a .NET Core Stylet MVVM sApplications", + "identity": "Stylet.Templates", + "shortName": "stylet", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "Company.StyletApplication1", + "preferNameDirectory": true, + "defaultName": "StyletApp1" +} diff --git a/StyletTemplates/templates/StyletApplication-CSharp/App.xaml b/StyletTemplates/templates/StyletApplication-CSharp/App.xaml new file mode 100644 index 0000000..bdf3bb5 --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/App.xaml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/StyletTemplates/templates/StyletApplication-CSharp/App.xaml.cs b/StyletTemplates/templates/StyletApplication-CSharp/App.xaml.cs new file mode 100644 index 0000000..ef64b7a --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Company.WpfApplication1 +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/StyletTemplates/templates/StyletApplication-CSharp/Bootstrapper.cs b/StyletTemplates/templates/StyletApplication-CSharp/Bootstrapper.cs new file mode 100644 index 0000000..670d57d --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/Bootstrapper.cs @@ -0,0 +1,19 @@ +using Company.WpfApplication1.Pages; +using Stylet; +using StyletIoC; + +namespace Company.WpfApplication1 +{ + public class Bootstrapper : Bootstrapper + { + protected override void ConfigureIoC(IStyletIoCBuilder builder) + { + // Configure the IoC container in here + } + + protected override void Configure() + { + // Perform any other configuration before the application starts + } + } +} diff --git a/StyletTemplates/templates/StyletApplication-CSharp/Company.StyletApplication1.csproj b/StyletTemplates/templates/StyletApplication-CSharp/Company.StyletApplication1.csproj new file mode 100644 index 0000000..bc5db3d --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/Company.StyletApplication1.csproj @@ -0,0 +1,14 @@ + + + + WinExe + netcoreapp3.0 + Company.WpfApplication1 + true + + + + + + + \ No newline at end of file diff --git a/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml new file mode 100644 index 0000000..6e4faae --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml @@ -0,0 +1,16 @@ + + + + Hello Stylet! + + + diff --git a/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml.cs b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml.cs new file mode 100644 index 0000000..bf6b3ba --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellView.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows; + +namespace Company.WpfApplication1.Pages +{ + /// + /// Interaction logic for ShellView.xaml + /// + public partial class ShellView : Window + { + public ShellView() + { + InitializeComponent(); + } + } +} diff --git a/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellViewModel.cs b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellViewModel.cs new file mode 100644 index 0000000..ee58c0b --- /dev/null +++ b/StyletTemplates/templates/StyletApplication-CSharp/Pages/ShellViewModel.cs @@ -0,0 +1,8 @@ +using Stylet; + +namespace Company.WpfApplication1.Pages +{ + public class ShellViewModel : Screen + { + } +} diff --git a/global.json b/global.json index 757b60c..99b142a 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.0.100-preview" + "version": "3.0.100" }, "msbuild-sdks": { "MSBuild.Sdk.Extras": "2.0.24"