MissingMethodException when running NSwag run on ASP.NET Core on net47
See original GitHub issueI’ve been trying to get NSwag to generate a typescript file for an ASP.NET Core application for the net47 target. This by using the aspnetcore2swagger generator and by giving it a csproj file (as apposed to an assembly).
Version info:
- .NET: net47
- asp.net core: 2.1.3
- nswag: 11.19.1
When running dotnet build
, I get the following error:
dotnet build
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 41.12 ms for D:\proj\nswagnetfull.csproj.
nswagnetfull -> D:\proj\bin\Debug\net47\nswagnetfull.exe
nswagnetfull -> D:\proj\bin\Debug\net47\nswagnetfull.Views.dll
NSwag command line tool for .NET 4.6.1+ WinX64, toolchain v11.19.1.0 (NJsonSchema v9.10.72.0 (Newtonsoft.Json v9.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\bob\.nuget\packages\nswag.msbuild\11.19.1\tools\Win
Executing file 'nswag.json'...
Launcher directory: D:\proj\bin\Debug\net47
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void Microsoft.AspNetCore.Hosting.Server.IServer.Start(Microsoft.AspNetCore.Hosting.Server.IHttpApplication`1<!!0>)'.
... (end stack trace)
D:\proj\nswagnetfull.csproj(54,5): error MSB3073: The command ""C:\Users\bob\.nuget\packages\nswag.msbuild\11.19.1\build\../tools/Win/NSwag.exe" run nswag.json" exited with code -1.
You can find a sample project with the to reproduce the issue at https://github.com/nicholas-brooks/nswag-aspnetcore-netfull-issue
Let me know if you need any more info.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
MissingMethodException when running NSwag run ...
I've been trying to get NSwag to generate a typescript file for an ASP.NET Core application for the net47 target.
Read more >ASP.NET Core error on building with NSwag Error MSB3073
NSwag fails when two methods of the same controller share the same HTTP GET (or HTTP ... tools/NetCore22/dotnet-nswag.dll" run nswag.json ...
Read more >ASP.NET Core Web API (OpenAPI) Client issue ...
For this issue, it seems that you are missing the namespace reference. Try to install or re-install the relates package. Besides, whether your ......
Read more >Get started with NSwag and ASP.NET Core
Learn how to use NSwag to generate documentation and help pages for an ASP.NET ... AspNetCore" package from the Browse tab and click...
Read more >nswag error in .NET Core 3.1 #8719
Hi,. I am using .NET Core 3.1 & Angular 8. I am facing an issue when running refresh.bat. It's throwing me below mentioned...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@RicoSuter and @pranavkm - I can confirm that NSWag v12.1.0 resolves the issue as I originally defined. My repo I referenced has been updated with the fix. I also tested the same repo using asp.net core 2.2 and it also works as expected (using nswag v12.1.0). I consider this issue resolved.
Thanks for your awesome work on nswag!
@RicoSuter are you able to reproduce the error using the application @nicholas-brooks provided? I just tried it now, and it built fine:
@farlee2121 do you have an application that you could share where the problem reproduces?