Skip to content

Commit 14ebe6d

Browse files
authored
Merge pull request #52 from giraffe-fsharp/net8
Rewrite for .NET 8
2 parents 2b8ab7f + 3ca21c8 commit 14ebe6d

File tree

19 files changed

+231
-217
lines changed

19 files changed

+231
-217
lines changed

README.md

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,39 @@ Giraffe web application template for the `dotnet new` command.
1010

1111
## Table of contents
1212

13-
- [Installation](#installation)
14-
- [Updating the template](#updating-the-template)
15-
- [Basics](#basics)
16-
- [Template Options](#template-options)
13+
- [Giraffe Template](#giraffe-template)
14+
- [Table of contents](#table-of-contents)
15+
- [Installation](#installation)
16+
- [Updating the template](#updating-the-template)
17+
- [Basics](#basics)
18+
- [Template Options](#template-options)
1719
- [ViewEngine](#viewengine)
1820
- [Solution](#solution)
1921
- [ExcludeTests](#excludetests)
2022
- [Paket](#paket)
21-
- [Known Issues](#known-issues)
23+
- [Known Issues](#known-issues)
2224
- [Cyclic reference](#cyclic-reference)
2325
- [.NET Core 2.0 issues](#net-core-20-issues)
2426
- [Using Visual Studio](#using-visual-studio)
25-
- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)
26-
- [Contributing](#contributing)
27-
- [More information](#more-information)
28-
- [License](#license)
27+
- [Example:](#example)
28+
- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)
29+
- [Contributing](#contributing)
30+
- [Examples](#examples)
31+
- [Default](#default)
32+
- [Installing the new template](#installing-the-new-template)
33+
- [Creating a test project for each permutation](#creating-a-test-project-for-each-permutation)
34+
- [Creating and testing all test projects for all permutations](#creating-and-testing-all-test-projects-for-all-permutations)
35+
- [Creating and testing all permutations and updating the `paket.lock` file afterwards](#creating-and-testing-all-permutations-and-updating-the-paketlock-file-afterwards)
36+
- [Testling the template locally](#testling-the-template-locally)
37+
- [More information](#more-information)
38+
- [License](#license)
2939

3040
## Installation
3141

3242
The easiest way to install the Giraffe template is by running the following command in your terminal:
3343

3444
```
35-
dotnet new -i "giraffe-template::*"
45+
dotnet new install "giraffe-template::*"
3646
```
3747

3848
This will pull and install the latest [giraffe-template NuGet package](https://www.nuget.org/packages/giraffe-template/) into your .NET environment and make it available to subsequent `dotnet new` commands.
@@ -43,21 +53,21 @@ Whenever there is a new version of the Giraffe template you can update it by re-
4353

4454
You can also explicitly set the version when installing the template:
4555

46-
```
47-
dotnet new -i "giraffe-template::1.4.0"
56+
```console
57+
dotnet new install "giraffe-template::1.4.0"
4858
```
4959

5060
## Basics
5161

5262
After the template has been installed you can create a new Giraffe web application by simply running `dotnet new giraffe` in your terminal:
5363

54-
```
64+
```console
5565
dotnet new giraffe
5666
```
5767

5868
If you wish to use [Paket](https://fsprojects.github.io/Paket/) for your dependency management use the `--Paket` or `-P` parameter when creating a new application:
5969

60-
```
70+
```console
6171
dotnet new giraffe --Paket
6272
```
6373

@@ -80,13 +90,13 @@ The Giraffe template supports four project templates, three different view engin
8090

8191
Use the `--ViewEngine` parameter (short `-V`) to set one of the supported values from above:
8292

83-
```
93+
```console
8494
dotnet new giraffe --ViewEngine razor
8595
```
8696

8797
The same command can be abbreviated using the `-V` parameter:
8898

89-
```
99+
```console
90100
dotnet new giraffe -V razor
91101
```
92102

@@ -96,13 +106,13 @@ If you do not specify the `--ViewEngine` parameter then the `dotnet new giraffe`
96106

97107
When running `dotnet new giraffe` the created project will only be a single Giraffe project which can be added to an existing .NET Core solution. However, when generating a new Giraffe project from a blank sheet then the `--Solution` (or short `-S`) parameter can simplify the generation of an entire solution, including a `.sln` file and accompanied test projects:
98108

99-
```
109+
```console
100110
dotnet new giraffe --Solution
101111
```
102112

103113
This will create the following structure:
104114

105-
```
115+
```text
106116
src/
107117
- AppName/
108118
- Views/
@@ -158,7 +168,7 @@ The affected SDKs are `2.1.x` where `x < 300`. The issue has been fixed in the S
158168

159169
If you do run into this issue the workaround is to explicitly specify the language:
160170

161-
```
171+
```console
162172
dotnet new giraffe -lang F#
163173
```
164174

@@ -176,7 +186,7 @@ All official Giraffe packages are published to the official and public NuGet fee
176186

177187
Unofficial builds (such as pre-release builds from the `develop` branch and pull requests) produce unofficial pre-release NuGet packages which can be pulled from the project's public NuGet feed on AppVeyor:
178188

179-
```
189+
```url
180190
https://ci.appveyor.com/nuget/giraffe-template
181191
```
182192

@@ -198,7 +208,7 @@ The `./build.ps1` PowerShell script comes with the following feature switches:
198208

199209
### Examples
200210

201-
#### Default:
211+
#### Default
202212

203213
Windows:
204214

@@ -212,7 +222,7 @@ macOS and Linux:
212222
$ pwsh ./build.ps1
213223
```
214224

215-
#### Installing the new template:
225+
#### Installing the new template
216226

217227
Windows:
218228

@@ -226,7 +236,7 @@ macOS and Linux:
226236
$ pwsh ./build.ps1 -InstallTemplate
227237
```
228238

229-
#### Creating a test project for each permutation:
239+
#### Creating a test project for each permutation
230240

231241
Windows:
232242

@@ -240,7 +250,7 @@ macOS and Linux:
240250
$ pwsh ./build.ps1 -CreatePermutations
241251
```
242252

243-
#### Creating and testing all test projects for all permutations:
253+
#### Creating and testing all test projects for all permutations
244254

245255
Windows:
246256

@@ -254,7 +264,7 @@ macOS and Linux:
254264
$ pwsh ./build.ps1 -TestPermutations
255265
```
256266

257-
#### Creating and testing all permutations and updating the `paket.lock` file afterwards:
267+
#### Creating and testing all permutations and updating the `paket.lock` file afterwards
258268

259269
Windows:
260270

@@ -268,6 +278,40 @@ macOS and Linux:
268278
$ pwsh ./build.ps1 -UpdatePaketDependencies
269279
```
270280

281+
#### Testling the template locally
282+
283+
If you already have giraffe-template installed, then
284+
285+
```console
286+
$ dotnet new uninstall giraffe-template
287+
```
288+
289+
This will install from the local file system
290+
291+
```console
292+
dotnet new install ./src/ --force
293+
```
294+
295+
To uninstall later:
296+
297+
```console
298+
$ dotnet new uninstall <some-path>/giraffe-template/src
299+
```
300+
301+
To use the template:
302+
303+
```console
304+
dotnet new giraffe
305+
```
306+
307+
Test it locally:
308+
309+
```console
310+
dotnet run --project giraffe-template.fsproj
311+
```
312+
313+
Remember to remove the template generated files
314+
271315
## More information
272316

273317
For more information about Giraffe, how to set up a development environment, contribution guidelines and more please visit the [main documentation](https://github.com/giraffe-fsharp/Giraffe#table-of-contents) page.

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Release Notes
22
=============
33

4+
## 1.5.0
5+
6+
- Updated templates to .NET 8 and latest Giraffe
7+
8+
49
## 1.4.0
510

611
- Updated templates to .NET 7 and latest Giraffe

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
init:
66
- git config --global core.autocrlf true
77
install:
8-
- ps: .\.psscripts\install-dotnet.ps1 -SdkVersions "7.0.304"
8+
- ps: .\.psscripts\install-dotnet.ps1 -SdkVersions "8.0.202"
99
build: off
1010
build_script:
1111
- ps: .\build.ps1

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"projects": [ "src", "tests" ],
33
"sdk": {
4-
"version": "7.0.304",
4+
"version": "8.0.202",
55
"rollForward": "latestMajor",
66
"allowPrerelease": false
77
}

src/content/DotLiquid/paket.dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ storage: none
22
framework: auto-detect
33
source https://api.nuget.org/v3/index.json
44

5-
nuget Giraffe ~> 6.0.0
5+
nuget Giraffe ~> 6.4.0
66
nuget Giraffe.DotLiquid >= 3 prerelease
77
nuget Microsoft.NET.Test.Sdk
88
nuget Microsoft.AspNetCore.TestHost

src/content/DotLiquid/paket.lock

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
STORAGE: NONE
2-
RESTRICTION: == net7.0
2+
RESTRICTION: == net8.0
33
NUGET
44
remote: https://api.nuget.org/v3/index.json
55
DotLiquid (2.2.692)
6-
FSharp.Core (7.0.400)
6+
FSharp.Core (8.0.200)
77
Giraffe (6.0)
88
FSharp.Core (>= 6.0.1)
99
Giraffe.ViewEngine (>= 1.3)
@@ -18,58 +18,50 @@ NUGET
1818
Ply (>= 0.3.1)
1919
Giraffe.ViewEngine (1.4)
2020
FSharp.Core (>= 5.0)
21-
Microsoft.AspNetCore.TestHost (7.0.10)
22-
System.IO.Pipelines (>= 7.0)
23-
Microsoft.CodeCoverage (17.7)
24-
Microsoft.IO.RecyclableMemoryStream (2.3.2)
25-
Microsoft.NET.Test.Sdk (17.7)
26-
Microsoft.CodeCoverage (>= 17.7)
27-
Microsoft.TestPlatform.TestHost (>= 17.7)
28-
Microsoft.NETCore.Platforms (7.0.4)
29-
Microsoft.TestPlatform.ObjectModel (17.7)
30-
NuGet.Frameworks (>= 6.5)
21+
Microsoft.AspNetCore.TestHost (8.0.4)
22+
System.IO.Pipelines (>= 8.0)
23+
Microsoft.CodeCoverage (17.9)
24+
Microsoft.IO.RecyclableMemoryStream (3.0)
25+
Microsoft.NET.Test.Sdk (17.9)
26+
Microsoft.CodeCoverage (>= 17.9)
27+
Microsoft.TestPlatform.TestHost (>= 17.9)
28+
Microsoft.TestPlatform.ObjectModel (17.9)
3129
System.Reflection.Metadata (>= 1.6)
32-
Microsoft.TestPlatform.TestHost (17.7)
33-
Microsoft.TestPlatform.ObjectModel (>= 17.7)
30+
Microsoft.TestPlatform.TestHost (17.9)
31+
Microsoft.TestPlatform.ObjectModel (>= 17.9)
3432
Newtonsoft.Json (>= 13.0.1)
35-
NETStandard.Library (2.0.3)
36-
Microsoft.NETCore.Platforms (>= 1.1)
3733
Newtonsoft.Json (13.0.3)
38-
NuGet.Frameworks (6.7)
3934
Ply (0.3.1)
4035
FSharp.Core (>= 4.6.2)
4136
System.Threading.Tasks.Extensions (>= 4.5.4)
42-
System.Collections.Immutable (7.0)
43-
System.IO.Pipelines (7.0)
37+
System.Collections.Immutable (8.0)
38+
System.IO.Pipelines (8.0)
4439
System.Reflection.Emit (4.7)
4540
System.Reflection.Emit.Lightweight (4.7)
46-
System.Reflection.Metadata (7.0.2)
47-
System.Collections.Immutable (>= 7.0)
48-
System.Text.Encodings.Web (7.0)
49-
System.Text.Json (7.0.3)
50-
System.Text.Encodings.Web (>= 7.0)
41+
System.Reflection.Metadata (8.0)
42+
System.Collections.Immutable (>= 8.0)
43+
System.Text.Encodings.Web (8.0)
44+
System.Text.Json (8.0.3)
45+
System.Text.Encodings.Web (>= 8.0)
5146
System.Threading.Tasks.Extensions (4.5.4)
5247
System.ValueTuple (4.5)
5348
Utf8Json (1.3.7)
5449
System.Reflection.Emit (>= 4.3)
5550
System.Reflection.Emit.Lightweight (>= 4.3)
5651
System.Threading.Tasks.Extensions (>= 4.4)
5752
System.ValueTuple (>= 4.4)
58-
xunit (2.5)
59-
xunit.analyzers (>= 1.2)
60-
xunit.assert (>= 2.5)
61-
xunit.core (2.5)
53+
xunit (2.8)
54+
xunit.analyzers (>= 1.13)
55+
xunit.assert (>= 2.8)
56+
xunit.core (2.8)
6257
xunit.abstractions (2.0.3)
63-
xunit.analyzers (1.2)
64-
xunit.assert (2.5)
65-
NETStandard.Library (>= 1.6.1)
66-
xunit.core (2.5)
67-
xunit.extensibility.core (2.5)
68-
xunit.extensibility.execution (2.5)
69-
xunit.extensibility.core (2.5)
70-
NETStandard.Library (>= 1.6.1)
58+
xunit.analyzers (1.13)
59+
xunit.assert (2.8)
60+
xunit.core (2.8)
61+
xunit.extensibility.core (2.8)
62+
xunit.extensibility.execution (2.8)
63+
xunit.extensibility.core (2.8)
7164
xunit.abstractions (>= 2.0.3)
72-
xunit.extensibility.execution (2.5)
73-
NETStandard.Library (>= 1.6.1)
74-
xunit.extensibility.core (2.5)
75-
xunit.runner.visualstudio (2.5)
65+
xunit.extensibility.execution (2.8)
66+
xunit.extensibility.core (2.8)
67+
xunit.runner.visualstudio (2.8)

src/content/DotLiquid/src/AppName.1/AppName.1.fsproj

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<AssemblyName>AppName.1.App</AssemblyName>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<AssemblyName>AppName.1</AssemblyName>
66
<EnableDefaultContentItems>false</EnableDefaultContentItems>
7+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
78
</PropertyGroup>
8-
99
<ItemGroup Condition="'$(Paket)' == false OR '$(Paket)' == ''">
10-
<PackageReference Include="Giraffe" Version="6.0.0" />
10+
<PackageReference Include="Giraffe" Version="6.4.0" />
1111
<PackageReference Include="Giraffe.DotLiquid" Version="3.0.0-rc-1" />
1212
</ItemGroup>
13-
1413
<ItemGroup>
1514
<Watch Include="**\*.html" Exclude="bin\**\*" />
1615
</ItemGroup>
17-
1816
<ItemGroup>
1917
<Compile Include="Models.fs" />
2018
<Compile Include="Program.fs" />
2119
</ItemGroup>
22-
2320
<ItemGroup>
2421
<None Include="web.config" CopyToOutputDirectory="PreserveNewest" />
2522
<None Condition="'$(Paket)' == true" Include="paket.references" />

0 commit comments

Comments
 (0)