Add a .NET Core template

This commit is contained in:
Antony Male 2019-09-24 14:51:33 +01:00
parent 2b3294e5ed
commit d6c2f8e7df
13 changed files with 201 additions and 3 deletions

View File

@ -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>(.+?)<\/VersionPrefix>/, 1] = version
File.open(CSPROJ, 'w'){ |f| f.write(content) }
content = IO.read(TEMPLATES_CSPROJ)
content[/<VersionPrefix>(.+?)<\/VersionPrefix>/, 1] = version
File.open(TEMPLATES_CSPROJ, 'w'){ |f| f.write(content) }
content = IO.read(NUSPEC_START)
content[/<version>(.+?)<\/version>/, 1] = args[:version]
content[%r{<dependency id="Stylet" version="\[(.+?)\]"/>}, 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[/<PackageReference Include="Stylet" Version="(.+?)" \/>/, 1] = version
File.open(csproj, 'w'){ |f| f.write(content) }
end
end
desc "Extract StyletIoC as a standalone file"

View File

@ -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

View File

@ -14,7 +14,7 @@
<VersionPrefix>0.0.0</VersionPrefix>
<PackageId>Stylet</PackageId>
<PackageTags>WPF MVVM ViewModel Screen Conductor ViewModel-First Model-View-ViewModel UI</PackageTags>
<PackageTags>WPF;MVVM;ViewModel;Screen Conductor;ViewModel-First;Model-View-ViewModel;UI</PackageTags>
<Copyright>Copyright © 2014 Antony Male</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png</PackageIconUrl>
<PackageProjectUrl>http://github.com/canton7/Stylet</PackageProjectUrl>
@ -22,7 +22,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/canton7/Stylet</RepositoryUrl>
<Authors>Antony Male</Authors>
<Description>A very lightweight but powerful ViewModel-First MVVM framework for WPF, inspired by Caliburn.Micro. Comes with its own IoC container.</Description>
<Description>A very lightweight but powerful ViewModel-First MVVM framework for WPF, inspired by Caliburn.Micro.</Description>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
@ -34,6 +34,10 @@
<ItemGroup Condition=" '$(ContinuousIntegrationBuild)' == 'true' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19351-01" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="System.Drawing.Common" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="obj\**" />

View File

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<PackageType>Template</PackageType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWpf>true</UseWpf>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
<VersionPrefix>0.0.0</VersionPrefix>
<PackageId>Stylet.Templates</PackageId>
<PackageTags>dotnet-new;templates;WPF;MVVM;ViewModel;Screen;Conductor;ViewModel-First;Model-View-ViewModel;UI</PackageTags>
<Copyright>Copyright © 2019 Antony Male</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png</PackageIconUrl>
<PackageProjectUrl>http://github.com/canton7/Stylet</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/canton7/Stylet</RepositoryUrl>
<Authors>Antony Male</Authors>
<Description>.NET Core templates for Stylet, the lightweight but powerful ViewModel-First MVVM framework for WPF,</Description>
</PropertyGroup>
<ItemGroup>
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
<Compile Remove="**\*" />
</ItemGroup>
</Project>

View File

@ -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"
}

View File

@ -0,0 +1,13 @@
<Application x:Class="Company.WpfApplication1.App"
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">
<Application.Resources>
<s:ApplicationLoader>
<s:ApplicationLoader.Bootstrapper>
<local:Bootstrapper/>
</s:ApplicationLoader.Bootstrapper>
</s:ApplicationLoader>
</Application.Resources>
</Application>

View File

@ -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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -0,0 +1,19 @@
using Company.WpfApplication1.Pages;
using Stylet;
using StyletIoC;
namespace Company.WpfApplication1
{
public class Bootstrapper : Bootstrapper<ShellViewModel>
{
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
// Configure the IoC container in here
}
protected override void Configure()
{
// Perform any other configuration before the application starts
}
}
}

View File

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

View File

@ -0,0 +1,16 @@
<Window x:Class="Company.WpfApplication1.Pages.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
Title="Stylet Project" Height="450" Width="800">
<Grid>
<TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">
Hello Stylet!
</TextBlock>
</Grid>
</Window>

View File

@ -0,0 +1,15 @@
using System.Windows;
namespace Company.WpfApplication1.Pages
{
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
public partial class ShellView : Window
{
public ShellView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,8 @@
using Stylet;
namespace Company.WpfApplication1.Pages
{
public class ShellViewModel : Screen
{
}
}

View File

@ -1,6 +1,6 @@
{
"sdk": {
"version": "3.0.100-preview"
"version": "3.0.100"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "2.0.24"