jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled exception. System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Identity.UI.Services.IEmailSender' from assembly 'Microsoft.Extensions.Identity.Core..' during compilation

Tony20221 opened this issue · comments

I created an Angular solution from the latest Clean.Architecture.Solution.Template template in VS 2002 17.8 Preview 4. I have 8.0.100-rc.2.23502.2 SDK installed.
I am getting the below error when I compile the app.

Severity Code Description Project File Line Suppression State
Error NSwag command line tool for .NET Core Net70, toolchain v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0));Visit http://NSwag.org for more information.;NSwag bin directory: C:\Users\Tony.nuget\packages\nswag.msbuild\13.19.0\tools\Net70;Executing file 'config.nswag' with variables 'Configuration=Debug'...;Launcher directory: C:\Users\Tony.nuget\packages\nswag.msbuild\13.19.0\tools\Net70;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.;---> System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Identity.UI.Services.IEmailSender' from assembly 'Microsoft.Extensions.Identity.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.;at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder);at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity[TUser](IServiceCollection services, Action1 configureOptions);at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity[TUser](IServiceCollection services);at Microsoft.Extensions.DependencyInjection.DependencyInjection.AddInfrastructureServices(IServiceCollection services, IConfiguration configuration) in C:\inetpub\wwwroot\CleanrArchitecture_JasonTaylorDev_FromTemplate\CleanrArchitecture_JasonTaylorDev_FromTemplate\src\Infrastructure\DependencyInjection.cs:line 34;at Program.<Main>$(String[] args) in C:\inetpub\wwwroot\CleanrArchitecture_JasonTaylorDev_FromTemplate\CleanrArchitecture_JasonTaylorDev_FromTemplate\src\Web\Program.cs:line 9;at Program.<Main>(String[] args);at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor);at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args);at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr);--- End of stack trace from previous location ---;at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost() in //src/NSwag.Commands/HostFactoryResolver.cs:line 271;at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass8_0.b__0(String[] args) in //src/NSwag.Commands/HostFactoryResolver.cs:line 75;at NSwag.Commands.ServiceProviderResolver.GetServiceProviderWithHostFactoryResolver(Assembly assembly) in //src/NSwag.Commands/HostApplication.cs:line 146;at NSwag.Commands.ServiceProviderResolver.GetServiceProvider(Assembly assembly) in //src/NSwag.Commands/HostApplication.cs:line 70;at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiGeneratorCommandEntryPoint.Process(String commandContent, String outputFile, String applicationName) in //src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiGeneratorCommandEntryPoint.cs:line 27;at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor);at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args);at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr);--- End of inner exception stack trace ---;at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr);at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters);at NSwag.AspNetCore.Launcher.Program.Main(String[] args) in //src/NSwag.AspNetCore.Launcher/Program.cs:line 132;System.InvalidOperationException: Swagger generation failed with non-zero exit code '1'.;at NSwag.Commands.Generation.AspNetCore.AspNetCoreToSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 231;at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in //src/NSwag.Commands/NSwagDocumentBase.cs:line 275;at NSwag.Commands.NSwagDocument.ExecuteAsync() in //src/NSwag.Commands/NSwagDocument.cs:line 81;at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 85;at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 32;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 61 Web C:\inetpub\wwwroot\CleanrArchitecture_JasonTaylorDev_FromTemplate\CleanrArchitecture_JasonTaylorDev_FromTemplate\src\Web\Web.csproj 66

Updated to the latest rc2 for all the packages. For now also removed everything related to nswag and swagger since it's not critical for running the app. The app runs now. Will revisit this when .NET 8 is out and this repo gets an update.

Updated the template to .NET 8, let me know if you run into further issues.