giraffe-fsharp / giraffe-template

A dotnet new template for Giraffe web applications.
Apache License 2.0
37 stars 22 forks source link

Error "cycle detected" using default template #27

Closed tpetricek closed 4 years ago

tpetricek commented 4 years ago

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]
gerardtoconnor commented 4 years ago

Hi Tomas, can you try update dotnet core to 2.2 as Giraffe is now on 2.2

tpetricek commented 4 years ago

I'll do that - I was expecting everything on this machine to be outdated :-).

In the meantime, renaming giraffee.fsproj to something else also solves the problem.

gerardtoconnor commented 4 years ago

In the meantime, renaming giraffee.fsproj to something else also solves the problem.

I have no clue how this is fixing it but good to know !? 🤔

TheAngryByrd commented 4 years ago

Oh it's because the name of the project file is the same as a dependency which breaks dotnet restore.

gerardtoconnor commented 4 years ago

Oh it's because the name of the project file is the same as a dependency which breaks dotnet restore.

Ah, good spot, that makes sense

tpetricek commented 4 years ago

I installed .NET Core 2.2 (info below) and still get the same error.

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.108
 Commit:    33ed5b90ce

The issue is still about recursive reference. Actually, it's not resolved by renaming the project file, but by changing the AssemblyName in the project file.

I'm really surprised I'm the first one to report this - I'd expect that everyone who creates a new Giraffe project will get this. Or is the recommended way to create project using some parameter that changes the assembly name? In any case, I think changing the assembly name in the template should solve this.

TheAngryByrd commented 4 years ago

I'm guessing your folder name was Giraffe.

For reference here's the issue in dotnet about it https://github.com/NuGet/Home/issues/6754

PR LGTM :)

dustinmoris commented 4 years ago

This fix has been released as part of 1.0.0: https://www.nuget.org/packages/giraffe-template/1.0.0