jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System.InvalidOperationException: The template directory "/home/j/code/jtest/src/Web/Templates" does not exist

JwanKhalaf opened this issue · comments

Describe the bug
Brand new solution with React chosen as the frontend fails to build. I am on Arch Linux.

To Reproduce
Steps to reproduce the behavior:

  1. Run dotnet new ca-sln -cf React -o jtest
  2. Then do dotnet build .
  3. I get the error below:
  Executing file 'config.nswag' with variables 'Configuration=Debug'...
  System.InvalidOperationException: The template directory "/home/j/code/jtest/src/Web/Templates" does not exist
     at NSwag.Commands.NSwagDocumentBase.ConvertToAbsolutePaths() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 343
     at NSwag.Commands.NSwagDocumentBase.FromJson[TDocument](String filePath, String data) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 227
     at NSwag.Commands.NSwagDocumentBase.LoadDocument[TDocument](String filePath, String data) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 209
     at NSwag.Commands.NSwagDocumentBase.LoadAsync[TDocument](String filePath, String variables, Boolean applyTransformations) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 203
     at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 64
     at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 33
     at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
     at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
     at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 62
/home/j/code/jtest/src/Web/Web.csproj(60,5): warning MSB3073: The command "dotnet "/home/j/.nuget/packages/nswag.msbuild/14.0.0-preview009/buildTransitive/../tools/Net80/dotnet-nswag.dll" run config.nswag /variables:Configuration=Debug" exited with code 255.
/home/j/code/jtest/src/Web/Web.csproj(66,5): error : NSwag command line tool for .NET Core Net80, toolchain v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0));Visit http://NSwag.org for more information.;NSwag bin directory: /home/j/.nuget/packages/nswag.msbuild/14.0.0-preview009/tools/Net80;Executing file 'config.nswag' with variables 'Configuration=Debug'...;System.InvalidOperationException: The template directory "/home/j/code/jtest/src/Web/Templates" does not exist;at NSwag.Commands.NSwagDocumentBase.ConvertToAbsolutePaths() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 343;at NSwag.Commands.NSwagDocumentBase.FromJson[TDocument](String filePath, String data) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 227;at NSwag.Commands.NSwagDocumentBase.LoadDocument[TDocument](String filePath, String data) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 209;at NSwag.Commands.NSwagDocumentBase.LoadAsync[TDocument](String filePath, String variables, Boolean applyTransformations) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 203;at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 64;at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 33;at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input);at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input);at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 62

Expected behavior
I expect the solution to build with no errors.

i had the same issue, here are the steps to make it work,

  1. Copy this folder CleanArchitecture/src/Web/Templates from the repository into the solution (it is missing),
  2. "npm i" inside de ClienApp folder
  3. "dotnet run" in src\Web folder

Thanks @afroukh, I did step 1, but can't do step 2 cause I don't have a ClientApp folder?

This is what I have:

~/code/jtest ❯ tree -L 2
.
├── src
│   ├── Application
│   ├── Domain
│   ├── Infrastructure
│   └── Web
├── tests
│   ├── Application.FunctionalTests
│   ├── Application.UnitTests
│   ├── Domain.UnitTests
│   ├── Infrastructure.IntegrationTests
│   └── Web.AcceptanceTests
├── Directory.Build.props
├── Directory.Packages.props
├── global.json
├── jtest.sln
└── README.md

12 directories, 5 files
~/code/jtest ❮

Hi, it's inside the web folder

Thanks @afroukh, it now complains about LocalDb not being supported:

SBuild version 17.8.3+195e7f5a3 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  SpecFlowFeatureFiles: Features/Login.feature
  -> Using default config
  Domain -> /home/j/code/jtest/src/Domain/bin/Debug/net8.0/jtest.Domain.dll
  Infrastructure.IntegrationTests -> /home/j/code/jtest/tests/Infrastructure.IntegrationTests/bin/Debug/net8.0/jtest.Infrastructure.IntegrationTests.dll
  SpecFlowGeneratedFiles: Features/Login.feature.cs
  Application -> /home/j/code/jtest/src/Application/bin/Debug/net8.0/jtest.Application.dll
  Domain.UnitTests -> /home/j/code/jtest/tests/Domain.UnitTests/bin/Debug/net8.0/jtest.Domain.UnitTests.dll
  Web.AcceptanceTests -> /home/j/code/jtest/tests/Web.AcceptanceTests/bin/Debug/net8.0/jtest.Web.AcceptanceTests.dll
  Infrastructure -> /home/j/code/jtest/src/Infrastructure/bin/Debug/net8.0/jtest.Infrastructure.dll
  Application.UnitTests -> /home/j/code/jtest/tests/Application.UnitTests/bin/Debug/net8.0/jtest.Application.UnitTests.dll
  Web -> /home/j/code/jtest/src/Web/bin/Debug/net8.0/jtest.Web.dll
  NSwag command line tool for .NET Core Net80, toolchain v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))
  Visit http://NSwag.org for more information.
  NSwag bin directory: /home/j/.nuget/packages/nswag.msbuild/14.0.0-preview009/tools/Net80
  
  Executing file 'config.nswag' with variables 'Configuration=Debug'...
  Launcher directory: /home/j/.nuget/packages/nswag.msbuild/14.0.0-preview009/tools/Net80
  fail: jtest.Infrastructure.Data.ApplicationDbContextInitialiser[0]
        An error occurred while initialising the database.
        System.PlatformNotSupportedException: LocalDB is not supported on this platform.
           at Microsoft.Data.SqlClient.SNI.LocalDB.GetLocalDBConnectionString(String localDbInstance)
           at Microsoft.Data.SqlClient.SNI.SNIProxy.GetLocalDBDataSource(String fullServerName, Boolean& error)
           at Microsoft.Data.SqlClient.SNI.SNIProxy.CreateConnectionHandle(String fullServerName, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Byte[]& instanceName, Byte[][]& spnBuffer, String serverSPN, Boolean flushCache, Boolean async, Boolean parallel, Boolean isIntegratedSecurity, SqlConnectionIPAddressPreference ipPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo, Boolean tlsFirst, String hostNameInCertificate, String serverCertificateFilename)
           at Microsoft.Data.SqlClient.SNI.TdsParserStateObjectManaged.CreatePhysicalSNIHandle(String serverName, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Byte[]& instanceName, Byte[][]& spnBuffer, Boolean flushCache, Boolean async, Boolean parallel, SqlConnectionIPAddressPreference iPAddressPreference, String cachedFQDN, SQLDNSInfo& pendingDNSInfo, String serverSPN, Boolean isIntegratedSecurity, Boolean tlsFirst, String hostNameInCertificate, String serverCertificateFilename)
           at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnectionString connectionOptions, Boolean withFailover)
           at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
           at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
           at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
           at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
           at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
           at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
           at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
           at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
           at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
           at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
        --- End of stack trace from previous location ---
           at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
           at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
           at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
           at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass20_0.<<ExistsAsync>b__0>d.MoveNext()
        --- End of stack trace from previous location ---
           at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass20_0.<<ExistsAsync>b__0>d.MoveNext()
        --- End of stack trace from previous location ---
           at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
           at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.ExistsAsync(CancellationToken cancellationToken)
           at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.MigrateAsync(String targetMigration, CancellationToken cancellationToken)
           at jtest.Infrastructure.Data.ApplicationDbContextInitialiser.InitialiseAsync() in /home/j/code/jtest/src/Infrastructure/Data/ApplicationDbContextInitialiser.cs:line 46

Apologies, I just found and fixed this issue in #1057. Wait for 8.0.1 and try again.