8000 Problem with NSwagStudio and FastEndpoints · Issue #5163 · RicoSuter/NSwag · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Problem with NSwagStudio and FastEndpoints #5163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TDS-NO opened this issue May 2, 2025 · 1 comment
Open

Problem with NSwagStudio and FastEndpoints #5163

TDS-NO opened this issue May 2, 2025 · 1 comment

Comments

@TDS-NO
Copy link
TDS-NO commented May 2, 2025

Hi

Trying to generate client code from a .net 9.0 .net core project, I get this error message :

I have only added a the path to my csproj file in the 'Project file path' field in the GUI.

It seems the problem is this line

The static resources manifest file 'C:\TDS\LAN.NET Core\TDS.GEO\TDS.GEO\bin\Debug\net9.0\NSwag.AspNetCore.Launcher.staticwebassets.endpoints.json' was not found.

In my bin folder the following file exist

'C:\TDS\LAN.NET Core\TDS.GEO\TDS.GEO\bin\Debug\net9.0\TDS.GEO.staticwebassets.endpoints.json'

So how can I get it to use my json file, not to use the prefix NSwag.AspNetCore.Launcher ?

Below is the complete error message.


Launcher directory: C:\Program Files (x86)\Rico Suter\NSwagStudio\Net90
System.InvalidOperationException: Swagger generation failed with non-zero exit code '1'.

Runtime: Net90
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 192
at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in /
/src/NSwag.Commands/NSwagDocumentBase.cs:line 266
at NSwag.Commands.NSwagDocument.ExecuteAsync() in //src/NSwag.Commands/NSwagDocument.cs:line 63
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /
/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 72
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in //src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 29
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

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.AggregateException: One or more errors occurred. (The static resources manifest file 'C:\TDS\LAN.NET Core\TDS.GEO\TDS.GEO\bin\Debug\net9.0\NSwag.AspNetCore.Launcher.staticwebassets.endpoints.json' was not found.)
---> System.InvalidOperationException: The static resources manifest file 'C:\TDS\LAN.NET Core\TDS.GEO\TDS.GEO\bin\Debug\net9.0\NSwag.AspNetCore.Launcher.staticwebassets.endpoints.json' was not found.
at Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.ResolveManifest(String manifestPath)
at Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssetsCore(IEndpointRouteBuilder endpoints, String manifestPath)
at Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssets(IEndpointRouteBuilder endpoints, String staticAssetsManifestPath)
at Program.

$(String[] args) in C:\TDS\LAN.NET Core\TDS.GEO\TDS.GEO\Program.cs:line 62
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at NSwag.Commands.ServiceProviderResolver.GetServiceProviderWithHostFactoryResolver(Assembly assembly) in /_/src/NSwag.Commands/HostApplication.cs:line 165 at NSwag.Commands.ServiceProviderResolver.GetServiceProvider(Assembly assembly) in /_/src/NSwag.Commands/HostApplication.cs:line 66 at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiGeneratorCommandEntryPoint.Process(String commandContent, String outputFile, String applicationName) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiGeneratorCommandEntryPoint.cs:line 26 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 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 129

Any help is apprishiated.

Regards

@brunopiovan
Copy link

I had the same issue, which seems to be caused by MapStaticAssets() when NSwag.MSBuild runs the project, I fixed it by replacing it with:

if (app.Environment.IsDevelopment())
{
    var assemblyTitle = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyTitleAttribute>()?.Title;
    if (assemblyTitle is not null)
    {
        app.MapStaticAssets($"{assemblyTitle}.staticwebassets.endpoints.json");
    }
}
else
{
    app.MapStaticAssets();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0