httpflow icon indicating copy to clipboard operation
httpflow copied to clipboard

Error when launching the newly created project from template

Open sdudnic-ingerop opened this issue 1 year ago • 2 comments

  • .NET SDK Version:

Steps to Reproduce:

  1. install/update the clean-architecture template
PS C:\proj> dotnet new install Ardalis.CleanArchitecture.Template
The following template packages will be installed:
   Ardalis.CleanArchitecture.Template

Ardalis.CleanArchitecture.Template (version 9.1.2) is already installed, it will be replaced with latest version.
Ardalis.CleanArchitecture.Template::9.1.2 was successfully uninstalled.
Success: Ardalis.CleanArchitecture.Template::9.1.2 installed the following templates:
Template Name                        Short Name  Language  Tags
-----------------------------------  ----------  --------  ------------------------------
ASP.NET Clean Architecture Solution  clean-arch  [C#]      Web/ASP.NET/Clean Architecture

PS C:\proj> dotnet new clean-arch -o clean-architecture           
The template "ASP.NET Clean Architecture Solution" was created successfully.

PS C:\proj> cd .\clean-architecture\
PS C:\proj\clean-architecture> ls

    Directory: C:\proj\clean-architecture

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          22/04/2024    15:56                src
d----          22/04/2024    15:56                tests
-a---          22/04/2024    15:56           7348 .editorconfig
-a---          22/04/2024    15:56          10601 clean-architecture.sln
-a---          22/04/2024    15:56            263 CODE_OF_CONDUCT.md
-a---          22/04/2024    15:56           2092 CONTRIBUTING.md
-a---          22/04/2024    15:56            449 Directory.Build.props
-a---          22/04/2024    15:56           2970 Directory.Packages.props
-a---          22/04/2024    15:56             84 global.json
-a---          22/04/2024    15:56          47548 icon.png
-a---          22/04/2024    15:56           1089 LICENSE
-a---          22/04/2024    15:56            746 nuget.config
-a---          22/04/2024    15:56          22878 README.md
  1. Launch the newly created template
PS C:\proj\clean-architecture> dotnet run --project .\src\clean-architecture.Web\           
Building...
C:\Program Files\dotnet\sdk\8.0.202\Microsoft.Common.CurrentVersion.targets(2153,5): warning : The referenced project '..\clean_architecture.Infrastructure\clean_architecture.Infrastructure.csproj' does not ex
ist. [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\Program Files\dotnet\sdk\8.0.202\Microsoft.Common.CurrentVersion.targets(2153,5): warning : The referenced project '..\clean_architecture.UseCases\clean_architecture.UseCases.csproj' does not exist. [C:\pro 
j\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Create.CreateContributorValidator.cs(1,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'clean_a
rchitecture' (are you missing an assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Create.cs(1,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an  
assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Delete.cs(2,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an  
assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\GetById.cs(2,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an 
 assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\List.cs(2,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an as 
sembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\List.cs(3,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an as 
sembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Update.cs(2,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an  
assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Update.cs(3,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an  
assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Contributors\Update.UpdateContributorValidator.cs(1,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'clean_a 
rchitecture' (are you missing an assembly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(3,15): error CS0234: The type or namespace name 'SharedKernel' does not exist in the namespace 'Ardalis' (are you missing an assembly reference? 
) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(4,26): error CS0234: The type or namespace name 'Core' does not exist in the namespace 'clean_architecture' (are you missing an assembly referen 
ce?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(5,26): error CS0234: The type or namespace name 'Core' does not exist in the namespace 'clean_architecture' (are you missing an assembly referen 
ce?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(6,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'clean_architecture' (are you missing an assemb 
ly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(7,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'clean_architecture' (are you missing an assemb
ly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(8,26): error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'clean_architecture' (are you missing an assemb
ly reference?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]
C:\proj\clean-architecture\src\clean-architecture.Web\Program.cs(9,26): error CS0234: The type or namespace name 'UseCases' does not exist in the namespace 'clean_architecture' (are you missing an assembly ref
erence?) [C:\proj\clean-architecture\src\clean-architecture.Web\clean-architecture.Web.csproj]

The build failed. Fix the build errors and run again.
PS C:\proj\clean-architecture>

sdudnic-ingerop avatar Apr 22 '24 16:04 sdudnic-ingerop

This is a known issue with hyphens clean-architecture in the name of your projects. I would suggest using Clean.Architecture or CleanArchitecture instead. It is listed in the README https://github.com/ardalis/CleanArchitecture?tab=readme-ov-file#using-the-dotnet-cli-template

KyleMcMaster avatar Apr 22 '24 16:04 KyleMcMaster

Yeah #284 was meant to fix it but never quite got to the finish line

ardalis avatar Apr 22 '24 17:04 ardalis