CleanArchitecture icon indicating copy to clipboard operation
CleanArchitecture copied to clipboard

It is impossible to launch a new project

Open pablogupi opened this issue 1 year ago • 8 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

pablogupi avatar Jan 19 '24 18:01 pablogupi

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

ArefAbdoli avatar Jan 23 '24 11:01 ArefAbdoli

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: https://github.com/zymlabs/nswag-fluentvalidation/issues/14

stpanzer avatar Feb 06 '24 15:02 stpanzer

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

saurabhverma-kashiit avatar Feb 11 '24 05:02 saurabhverma-kashiit

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

not working

saurabhverma-kashiit avatar Feb 11 '24 05:02 saurabhverma-kashiit

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.

jasontaylordev avatar Feb 15 '24 23:02 jasontaylordev

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

rlarno avatar Feb 20 '24 15:02 rlarno

dotnet new update Clean.Architecture.Solution.Template

jasontaylordev avatar Feb 20 '24 22:02 jasontaylordev

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)

rlarno avatar Feb 21 '24 14:02 rlarno

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.

jasontaylordev avatar Feb 28 '24 23:02 jasontaylordev