jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It is impossible to launch a new project

pablogupi opened this issue · comments

Describe the bug
When we run the "dotnet run" command in the web folder, it is not possible to launch the project without errors.
To Reproduce
Steps to reproduce the behavior:
1..Create a new project using version 8.0.2
2. cd to src/Web
3. dotnet run

At the moment the result is many red lines.

For example:

/Web/Web.csproj(60,5): warning MSB3073: The command "dotnet "/Users/pablo/.nuget/packages/nswag.msbuild/14.0.0-preview010/buildTransitive/../tools/Net80/dotnet-nswag.dll" run config.nswag /variables:Configuration=Debug" exited with code 255.

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: /Users/pablo/.nuget/packages/nswag.msbuild/14.0.0-preview010/tools/Net80;Executing file 'config.nswag' with variables 'Configuration=Debug'...;Launcher directory: /Users/pablo/.nuget/packages/nswag.msbuild/14.0.0-preview010/tools/Net80

If I run manually this command: dotnet "/Users/pablo/.nuget/packages/nswag.msbuild/14.0.0-preview010/buildTransitive/../tools/Net80/dotnet-nswag.dll" run config.nswag /variables:Configuration=Debug

The result is:

Executing file 'config.nswag' with variables 'Configuration=Debug'...
Launcher directory: /Users/pablo/.nuget/packages/nswag.msbuild/14.0.0-preview010/tools/Net80
warn: ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor[0]
      Error on apply rule 'NotEmpty' for property 'CreateTodoItemCommand.title'
      System.MissingMethodException: Method not found: 'NJsonSchema.JsonObjectType NJsonSchema.JsonSchema.get_Type()'.
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.<>c.<CreateDefaultRules>b__9_6(RuleContext context)
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.ApplyRulesToSchema(SchemaProcessorContext context, IValidator validator)
warn: ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor[0]
      Error on apply rule 'NotEmpty' for property 'UpdateTodoItemCommand.title'
      System.MissingMethodException: Method not found: 'NJsonSchema.JsonObjectType NJsonSchema.JsonSchema.get_Type()'.
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.<>c.<CreateDefaultRules>b__9_6(RuleContext context)
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.ApplyRulesToSchema(SchemaProcessorContext context, IValidator validator)
warn: ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor[0]
      Error on apply rule 'NotEmpty' for property 'CreateTodoListCommand.title'
      System.MissingMethodException: Method not found: 'NJsonSchema.JsonObjectType NJsonSchema.JsonSchema.get_Type()'.
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.<>c.<CreateDefaultRules>b__9_6(RuleContext context)
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.ApplyRulesToSchema(SchemaProcessorContext context, IValidator validator)
warn: ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor[0]
      Error on apply rule 'NotEmpty' for property 'UpdateTodoListCommand.title'
      System.MissingMethodException: Method not found: 'NJsonSchema.JsonObjectType NJsonSchema.JsonSchema.get_Type()'.
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.<>c.<CreateDefaultRules>b__9_6(RuleContext context)
         at ZymLabs.NSwag.FluentValidation.FluentValidationSchemaProcessor.ApplyRulesToSchema(SchemaProcessorContext context, IValidator validator)
Done.

Expected behavior
The application should be launched without errors

Hi. In "config.nswag" file change value of "aspNetCoreEnvironment" property from null to string like "LocalDevelopment" and try again.

The fundamental issue is an incompatibility between Nswag.FluentValidation and the version of NJsonSchema provided by Nswag, there is an open issue in that repository here: zymlabs/nswag-fluentvalidation#14

Any solution to this issue, I am stuck and tried many things but still not able to run!

Hi. In "config.nswag" file change value of "aspNetCoreEnvironment" property from null to string like "LocalDevelopment" and try again.

not working

I released a new version, 8.0.3 that does not use NSwag.FluentValidation. Please upgrade to the latest version of the template and try again.

Hi, what is the best approach to update to the new version?

dotnet new update Clean.Architecture.Solution.Template

Sorry, my bad, not the template but my project evolved from the template.

Currently, I created a new project using the new template, and then did a manual diff between that new version and my project. (which obviously already has evolved from the pristine template). Is there a 'better' way? I almost wish I could replay the commits onto my project and review the changes made (running the tests for each/most changes, to ensure it still works)

One approach you could use to compare changes between versions is as follows:

  1. Create Project1 using old template dotnet new ca-sln ...
  2. Run:
     git init
     git add .
     git commit -m "Initial project"
  3. Delete all the solution and project files (except .git)
  4. Upgrade to new template dotnet new install ...
  5. Create again in same folder using dotnet new ca-sln ...

You can then compare the changes in git.