giraffe-fsharp / giraffe-template Goto Github PK
View Code? Open in Web Editor NEWA dotnet new template for Giraffe web applications.
License: Apache License 2.0
A dotnet new template for Giraffe web applications.
License: Apache License 2.0
sh build.sh
I get the following error:$ sh build.sh
build.sh: 8: build.sh: Syntax error: end of file unexpected (expecting "then")
-U
flag$ mono .paket/paket.exe
Error: SecureChannelFailure (The authentication or decryption has failed.) (Github - cached (temporarily ignore updates))
I believe you tried to address this in #12 but that doesn't seem to have fixed the issue for me. I have tried to re-install the template using dotnet new -i "giraffe-template::0.17.0"
but that does not seem to have helped either.
When I replace packet.exe
with the version I have explicitly downloaded from the paket github repo, things work fine.
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.302
Commit: 9048955601
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.302/
Host (useful for support):
Version: 2.1.2
Commit: 811c3ce6c0
.NET Core SDKs installed:
2.1.302 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
It looks like dotnet restore is getting confused by both the project and the package being named Giraffe.
Original: giraffe-fsharp/Giraffe#274
I installed giraffe-template and attempted to create a new project, but nothing happens when I run the command. My output is below. I'm starting in a new, empty directory. Running dotnet new mvc
(for example) works properly, it's only giraffe that doesn't work.
C:\Users\vaindil\Documents\notes-api-fsharp
λ dotnet new -l
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Templates Short Name Language Tags
--------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
Unit Test Project mstest [C#], F#, VB Test/MSTest
xUnit Test Project xunit [C#], F#, VB Test/xUnit
ASP.NET Core Empty web [C#], F# Web/Empty
ASP.NET Core Web App (Model-View-Controller) mvc [C#], F# Web/MVC
ASP.NET Core Web App razor [C#] Web/MVC/Razor Pages
ASP.NET Core with Angular angular [C#] Web/MVC/SPA
ASP.NET Core with React.js react [C#] Web/MVC/SPA
ASP.NET Core with React.js and Redux reactredux [C#] Web/MVC/SPA
ASP.NET Core Web API webapi [C#], F# Web/WebAPI
global.json file globaljson Config
NuGet Config nugetconfig Config
Web Config webconfig Config
Solution File sln Solution
Razor Page page Web/ASP.NET
MVC ViewImports viewimports Web/ASP.NET
MVC ViewStart viewstart Web/ASP.NET
C:\Users\vaindil\Documents\notes-api-fsharp
λ dotnet new -i "giraffe-template::*"
Restoring packages for C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\restore.csproj...
Installing giraffe-template 0.11.0.
Generating MSBuild file C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\obj\restore.csproj.nuget.g.props.
Generating MSBuild file C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\obj\restore.csproj.nuget.g.targets.
Restore completed in 993.21 ms for C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\restore.csproj.
Restoring packages for C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\restore.csproj...
Installing giraffe-template 0.11.0.
Generating MSBuild file C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\obj\restore.csproj.nuget.g.props.
Generating MSBuild file C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\obj\restore.csproj.nuget.g.targets.
Restore completed in 791.48 ms for C:\Users\vaindil\.templateengine\dotnetcli\v2.1.2\scratch\restore.csproj.
Templates Short Name Language Tags
--------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
Unit Test Project mstest [C#], F#, VB Test/MSTest
xUnit Test Project xunit [C#], F#, VB Test/xUnit
ASP.NET Core Empty web [C#], F# Web/Empty
Giraffe Web App giraffe F# Web/Giraffe/ASP.NET
ASP.NET Core Web App (Model-View-Controller) mvc [C#], F# Web/MVC
ASP.NET Core Web App razor [C#] Web/MVC/Razor Pages
ASP.NET Core with Angular angular [C#] Web/MVC/SPA
ASP.NET Core with React.js react [C#] Web/MVC/SPA
ASP.NET Core with React.js and Redux reactredux [C#] Web/MVC/SPA
ASP.NET Core Web API webapi [C#], F# Web/WebAPI
global.json file globaljson Config
NuGet Config nugetconfig Config
Web Config webconfig Config
Solution File sln Solution
Razor Page page Web/ASP.NET
MVC ViewImports viewimports Web/ASP.NET
MVC ViewStart viewstart Web/ASP.NET
Examples:
dotnet new mvc --auth Individual
dotnet new viewimports --namespace
dotnet new --help
C:\Users\vaindil\Documents\notes-api-fsharp
λ dotnet new giraffe
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Giraffe Web App (F#)
Author: Dustin Moris Gorski, David Sinclair and contributors
Options:
-V|--ViewEngine
giraffe - Default GiraffeViewEngine
razor - MVC Razor views
dotliquid - DotLiquid template engine
Default: giraffe
-I|--IncludeTests
bool - Optional
Default: false
C:\Users\vaindil\Documents\notes-api-fsharp
λ dir
Volume in drive C is SSD
Volume Serial Number is [censored]
Directory of C:\Users\vaindil\Documents\notes-api-fsharp
12/25/2017 01:54 PM <DIR> .
12/25/2017 01:54 PM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 108,673,515,520 bytes free
C:\Users\steven.hall\Documents\notes-api-fsharp
λ dotnet new giraffe --force
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Giraffe Web App (F#)
Author: Dustin Moris Gorski, David Sinclair and contributors
Options:
-V|--ViewEngine
giraffe - Default GiraffeViewEngine
razor - MVC Razor views
dotliquid - DotLiquid template engine
Default: giraffe
-I|--IncludeTests
bool - Optional
Default: false
C:\Users\steven.hall\Documents\notes-api-fsharp
λ dir
Volume in drive C is SSD
Volume Serial Number is [censored]
Directory of C:\Users\steven.hall\Documents\notes-api-fsharp
12/25/2017 01:54 PM <DIR> .
12/25/2017 01:54 PM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 108,729,307,136 bytes free
There's no paket-file exclusion in the/None
section of the content file copies, so if the user doesn't use paket they still get paket.dependencies and paket.references.
Currently the build.sh
file generated by running dotnet new giraffe
is created with CRLF line endings. When run on Linux (where LF line endings are the norm), this results in the CR character being seen as part of the line, like so (^M
represents a CR in this listing):
dotnet restore src/LearnGiraffe^M
dotnet build src/LearnGiraffe^M
This results in the dotnet CLI tool saying "Project file does not exist", because it's looking for a directory named src/LearnGiraffe^M
, which of course does not exist. If the build.sh
file is produced with LF line endings instead of CRLF, then it should work properly.
I tested on Linux Mint 18, equivalent to Ubuntu 16.04, but I expect the same thing would happen on just about any Linux version.
Hi. I encountered error about paket.exe (in fact paket.bootstrapper.exe).
I did following operations on pwsh.exe, Windows10.
$ dotnet new giraffe -lang F# --UsePaket -o fooproj
$ cd fooproj
$ dotnet build src/fooproj
And error message.
Japanese part is maybe 'The request was aborted: Could not create SSL/TLS secure channel'.
要求は中止されました: SSL/TLS のセキュリティで保護されているチャネルを作成できませんでした (Github - cached (temporarily ignore updates))
Simply download latest paket.bootstrapper.exe from fsprojects/Paket and rename to 'paket.exe' and replace.
This is maybe the result of Github blog: Weak cryptographic standards removed.
Thanks.
Steps to reproduce:
$ dotnet new giraffe -n giraffe-test
...
$ chmod a+x #fix bug #23
$ ./build.sh
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/giraffe_test
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
$ cat build.sh
#!/bin/sh
dotnet restore src/giraffe_test
dotnet build src/giraffe_test
$ ls src/giraffe_test
ls: src/giraffe_test: No such file or directory
$ ls src
giraffe-test
$ dotnet --version
2.2.105
Add none
as an option to the --ViewEngine
parameter which will create a new Giraffe API only app.
x-post issue with Giraffe main project
Sorry to dupe the issues, but wasn't sure which project this falls under.
Feel free to close one or the other,
Gina
I've created new project using dotnet new giraffe --UsePaket -o error-giraffe
and ran the build.bat
file.
C:\temp\error-giraffe>dotnet build src/error_giraffe
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/error_giraffe
When I look into the src
folder I see a folder named AppNamePlaceholder
, while the bat file contains
IF NOT EXIST paket.lock (
START /WAIT .paket/paket.exe install
)
dotnet restore src/error_giraffe
dotnet build src/error_giraffe
Are dashes a problem?
No matter what dotnet new giraffe
flags I use, the result is the same:
$ dotnet new giraffe -o WithTemplate
The template "Giraffe" was created successfully.
$ cd WithTemplate/
$ dotnet watch run
dotnet watch 🚀 Started
dotnet watch ❌ Exited with error code 137
dotnet watch ⏳ Waiting for a file to change before restarting dotnet...
Completely new to ASP.NET Core (and .NET in general), so I tried the tutorial on Get started with ASP.NET Core | Microsoft Learn, and it worked.
Then I did the manual approach, but that one worked too:
$ dotnet new sln -o ByHand
The template "Solution File" was created successfully.
$ cd ByHand
$ dotnet new web -lang "F#" -o src/ByHand
The template "ASP.NET Core Empty" was created successfully.
Processing post-creation actions...
Restoring /Users/toraritte/dev/shed/dotnet/giraffe/ByHand/src/ByHand/ByHand.fsproj:
Determining projects to restore...
Restored /Users/toraritte/dev/shed/dotnet/giraffe/ByHand/src/ByHand/ByHand.fsproj (in 1.09 sec).
Restore succeeded.
$ dotnet sln add src/ByHand/ByHand.fsproj
Project `src/ByHand/ByHand.fsproj` added to the solution.
$ cd src/ByHand/
$ dotnet add package Microsoft.AspNetCore.App
$ dotnet add package Giraffe
Determining projects to restore...
/usr/local/share/dotnet/sdk/8.0.202/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.Shared.targets(111,5): warning NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference. [/Users/toraritte/dev/shed/dotnet/giraffe/ByHand/src/ByHand/ByHand.fsproj]
Opened up Program.fs, and pasted the "more functional way" example from https://giraffe.wiki/#doing-it-manually, then
$ dotnet watch run
Did I miss something in the README?
Consider using UseDeveloperExceptionPage when running in Development
instead of the default UseGiraffeErrorHandler
.
I tried creating a simple project with Giraffe using (in Git bash on Windows):
$ dotnet new -i "giraffe-template::*"
$ dotnet new giraffe
$ ./build.sh
This fails with:
$ ./build.sh
Restoring packages for C:\Temp\giraffe\src\giraffe\giraffe.fsproj...
C:\Temp\giraffe\src\giraffe\giraffe.fsproj : error NU1108: Cycle detected.
C:\Temp\giraffe\src\giraffe\giraffe.fsproj : error NU1108: giraffe -> Giraffe (>= 3.4.0).
Restore failed in 992.36 ms for C:\Temp\giraffe\src\giraffe\giraffe.fsproj.
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
My .NET version and runtims are:
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.502
Commit: c74ce8f29f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.502\
Host (useful for support):
Version: 2.1.6
Commit: 3f4f8eebd8
.NET Core SDKs installed:
1.1.11 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
So after adding the new --ViewEngine none option I was playing around with the templates and got a bit annoyed that the cleanliness that existed before isn't there anymore.
Now you end up with directories like Projects/WebSocketApp/src/WebSocketApp/ with the different build files and maybe I'm missing the point (I know paket support is in the pipe) but maybe this is the wrong way to go? Or maybe we should split the template?
In a couple of months we'll probably have better support in Visual Studio and it would've been nice to just be able to open an existing Giraffe project and continue working with it but it seems we're maybe cutting that option out?
Anyway just want to get a discussion around this going.
This is not a big issue but is a bit strange so I thought I'd create an issue.
When running dotnet new giraffe -lang f# -n ProjectName
I'm successfully able to create the project, but the template fails in the post-action when attempting to make the build scripts executable. It appears that whatever script is executing the template install is treating the chmod
arguments as separate commands.
Processing post-creation actions...
The files /Users/tabork/Development/fsharp/FirstGiraffeWebApp/chmod, /Users/tabork/Development/fsharp/FirstGiraffeWebApp/+x, and /Users/tabork/Development/fsharp/FirstGiraffeWebApp/*.sh do not exist.
Unable to apply permissions +x to "*.sh".
Post action failed.
Description: Make scripts executable
Manual instructions: Run 'chmod +x *.sh'
This is occurring on Mac OSX, with Dotnet SDK 2.1.4 installed.
Please let me know if you need additional information.
@dustinmoris I have written some PowerShell permutation tests for another template project at work using Invoke-Build.
Wondering if you would be interested in me adding something like this?
I found adding the --UsePaket
a bit tedious testing different permutations after each test.
What the tests do are:
loop through permutations and do...
Interested?
I have been working with the .NET platform since 2015, I try to communicate often with other c# and f# developers and there is a feeling that a very small number of people use Paket. And if they do, then there are problems with the lock file and updates
Repro:
dotnet new -i "giraffe-template::*"
dotnet new giraffe
Expected:
A project is created
Actual:
I get a help message. I've tried specifying the ViewEngine as well to no avail.
C:\users\conniey\Source\Repos\giraffe-app
λ dotnet new giraffe
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Giraffe Web App (F#)
Author: Dustin Moris Gorski, David Sinclair and contributors
Options:
-V|--ViewEngine
giraffe - Default GiraffeViewEngine
razor - MVC Razor views
dotliquid - DotLiquid template engine
none - No template engine (API only)
Default: giraffe
-I|--IncludeTests
bool - Optional
Default: false
-U|--UsePaket
bool - Optional
Default: false
We currently don't have a deploy CI step and release process like we do in Giraffe.
If ASPNETCORE_ENVIRONMENT
is unset it defaults to Production
. Testing out the API with something like curl http://localhost:5000/api/hello
will then output nothing without raising an error from curl
or the server due to the call to UseHttpsRedirection()
. The situation becomes evident if one thinks to pass -v
or -L
to curl
, but it took me longer to figure out than I'd care to admit. A mention of the need to explicitly set ASPNETCORE_ENVIRONMENT=Development
in README.md
and/or the comments in the template itself could solve the issue. This is probably fairly obvious to those with more knowledge of ASP.NET than myself, but I thought I'd bring it up since this is now the second time I've managed to trip over it while setting up a new project.
The template build file on the solution template fails to build if it isn't on the right project.
I think it would be better if the build file specified the right project for the operation, including explicitly the project's path.
#!/bin/sh
dotnet restore
dotnet build --no-restore
dotnet test --no-build
#!/bin/sh
dotnet restore
dotnet build ./src/AppName --no-restore
dotnet test ./tests/AppName.Tests --no-build
Hi!
Mentioned in #6 but perhaps not fully expressed, the giraffe dotnet new template breaks the "implicit" contract that most dotnet new templates seems to fulfill regarding where the files are placed.
Background:
I'm writing a script that is used to compose different dotnet new templates into a solution and I'm running into a problem with the giraffe template directory layout that I haven't seen with any other major dotnet new template.
I'd even go so far to say that the giraffe template breaks the "implicit" dotnet new template contract (I know it is an implicit/defacto/tacit contract but still) by adding the giraffe application into a pre-determined src folder.
All other dotnet new templates that creates a project (console, classlib, mstest, nunit, web, webapi etc) follow the contract that the project files are by default created in the current directory with the current directory name being used as the project name.
Templates following this contract make them composable into solutions, addable into existing solutions without imposing any kind of structure.
I'd claim that although the src folder pattern is good, the structure of any solution and source tree is a decision to be made by the developer setting it up and therefore a solution composition concern and not a template concern.
My understanding is that the need for this is having the option for the testproject option available. This is together with the paket option are composition concerns and should not be part of any specific template. If you want to distribute a test project that should go into it's own template in the package.
What one should be able to to do is something similar to:
dotnet new classlib -lang f# -o model
dotnet new xunit -lang f# -o model.tests
dotnet new giraffe -o api
dotnet new giraffe.tests -o api.tests
dotnet sln add model
dotnet sln add model.tests
dotnet sln add api
dotnet sln add api.tests
Currently, if one run dotnet new giraffe -o api
one will get this structure that makes no sense.
\---api
\---src
\---api
\---WebRoot
I installed the Giraffe template suite via the instructions on the README.md and when I do:
dotnet new -h
it shows me the Giraffe template, as well as some other web templates.
I tried to run dotnet new giraffe --IncludeTests --UsePaket -n HttpProjectName
and got nothing except the help output on how to use the Giraffe template. If I fat-finger the flags, like, --UsePkt
it gives the correct argument warning. I then tried just running dotnet new giraffe
which also didn't work-- just gave the help output. Installing other non-giraffe templates like the default console or mvc for dotnet works. I'm using powershell.
Here is the help output I see in my shell:
PS Y:\Repos\HttpSeedProject> dotnet new giraffe --IncludeTests --UsePaket -n HttpSeedProject
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Giraffe Web App (F#)
Author: Dustin Moris Gorski, David Sinclair and contributors
Options:
-V|--ViewEngine
giraffe - Default GiraffeViewEngine
razor - MVC Razor views
dotliquid - DotLiquid template engine
none - No template engine (API only)
Default: giraffe
-I|--IncludeTests
bool - Optional
Configured Value: True
Default: false
-U|--UsePaket
bool - Optional
Configured Value: True
Default: false
Any idea what I'm doing wrong or how I can debug?
Thanks for your time.
Gina
Moving the original issue from the giraffe-fsharp/Giraffe repo over here.
Original issue by @nicolocodev:
I'm working on the template project to add the flag -enablepaket
'cause paket is nice 💪
I'm using custom operations in order to use conditionals on .fsproj
:
<!-- if(enablepaket) -->
<Import Project="..\..\.paket\Paket.Restore.targets" />
<!-- else -->
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.0.*" />
it's not working by now, always get the conditional comments on fsproj... but what do you think 👍 👎?
Build scripts here don't have shebangs or pass shellcheck, so by default they don't work
When updated dependencies i noticed that some nugets are really old and other nugets have different versions of nugets inside
Giraffe.DotLiquid >= 3 prerelease
Giraffe.Razor >= 5.1.0 prerelease
Hi, thank you for reading this.
I was just getting started with Giraffe, and expected that the server will log to console under which port it will serve.
info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0] Content root path: C:\Users\fb\OneDrive\code\schnelltest
but because of
builder.AddFilter(fun l -> l.Equals LogLevel.Error)
this was not displayed.
The server is completely silent, which took me some time to find out that it's running fine.
My experience would have been better, when then Information Log were shown, which I now suggest.
Currently the build script simply packages up the templates into a NuGet library, but I'd like the build script to first build and test each individual template before the final template package gets created.
This should be easily possible with the current set up where each template is placed as an individual project which can be build and tested straight from the IDE. The benefit of having this automated via a build script is obviously that it will reduce the possibility of a broken template before each release.
Giraffe throws an error just after creating a project with following template (Linux shell example):
dotnet new giraffe --language F# --name Demo --output FSharp.Demo && cd $_
dotnet run --project src/Demo/Demo.fsproj
It yields:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Nothing serious because I can solve it installing the json package, like:
dotnet add src/Demo/Demo.fsproj package Newtonsoft.Json
but I wouldn't expect an error in first place.
Change
[<EntryPoint>]
let main _ =
let contentRoot = Directory.GetCurrentDirectory()
let webRoot = Path.Combine(contentRoot, "WebRoot")
Host.CreateDefaultBuilder()
//...
to
[<EntryPoint>]
let main args =
let contentRoot = Directory.GetCurrentDirectory()
let webRoot = Path.Combine(contentRoot, "WebRoot")
Host.CreateDefaultBuilder(args)
//...
By doing so the command line arguments are parsed by the default builder (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#default-configuration).
Hi,
I just started using Giraffe, and scaffolded using
dotnet new giraffe -o GiraffeWebUI -lang F# -I -U
Here are some changes I made, because I wanted to run on .NET Core 3.x (not all are needed)
dotnet tool restore
and dotnet paket install/restore(?)
for bootstrapping using local tool. Same goes for readme, I guess.nuget FSharp.Core 4.7.0
in dependencies.paketnuget Microsoft.AspNetCore.App
in dependencies.paket (shared framework in 3.x)open Microsoft.Extensions.Hosting
in program.fs, after having changed to using IWebHostEnvironment
in configureAppSorry for opening all these in single issue. Maybe not all people are on netcoreapp3.x (I doubt it when we are talking dotnet new
for giraffe-beginners like myself). Anyway this is just a heads up. Nothing important 😉
Maybe I forgot something.
Looking forward to using F# on aspnetcore.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.