You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I add Aspire SEQ integration the MSBuild task breaks with the following exception:
NSwag command line tool for .NET Core Net90, toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0));Visit http://NSwag.org for more information.;NSwag bin directory: C:\Users\JohnKattenhorn.nuget\packages\nswag.msbuild\14.2.0\tools\Net90;Executing file 'config.nswag' with variables 'Configuration=Debug'...;Launcher directory: C:\Users\JohnKattenhorn.nuget\packages\nswag.msbuild\14.2.0\tools\Net90;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.; ---> System.InvalidOperationException: NSwag requires the assembly Applicita.TestApp.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null to have either an BuildWebHost or CreateWebHostBuilder/CreateHostBuilder method
This is caused by these lines of code in the Aspire.Seq extension because at BuildTime the settings.ServerUrl is null (its populated during runtime), I'm guessing the NSwag build task is executing this code.
if (!settings.DisableHealthChecks)
{
if (settings.ServerUrl is not null)
{
builder.TryAddHealthCheck(new HealthCheckRegistration(
"Seq",
_ => new SeqHealthCheck(settings.ServerUrl),
failureStatus: default,
tags: default));
}
else
{
throw new InvalidOperationException(
"Unable to add a Seq health check because the 'ServerUrl' setting is missing.");
}
}
I've also logged an issue for awareness on the Aspire Site, any workarounds or thoughts about what the Aspire Code should look like or modification to the NSwag configuration would be appreciated.
The text was updated successfully, but these errors were encountered:
My issue affects more that Seq, it's also having problems with EF and Migrations. I'm still looking at the MSBuild Task documentation but it's seems to be that operates on the assumption that all configuration is being done statically at runtime.
It's almost like it needs to start the Aspire Runtime before it starts the documentation generation.
Describe the bug
If I add Aspire SEQ integration the MSBuild task breaks with the following exception:
NSwag command line tool for .NET Core Net90, toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0));Visit http://NSwag.org for more information.;NSwag bin directory: C:\Users\JohnKattenhorn.nuget\packages\nswag.msbuild\14.2.0\tools\Net90;Executing file 'config.nswag' with variables 'Configuration=Debug'...;Launcher directory: C:\Users\JohnKattenhorn.nuget\packages\nswag.msbuild\14.2.0\tools\Net90;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.; ---> System.InvalidOperationException: NSwag requires the assembly Applicita.TestApp.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null to have either an BuildWebHost or CreateWebHostBuilder/CreateHostBuilder method
This is caused by these lines of code in the Aspire.Seq extension because at BuildTime the settings.ServerUrl is null (its populated during runtime), I'm guessing the NSwag build task is executing this code.
Version used
14.2
To Reproduce
Create a Aspire Starter app from the Visual Studio 2022, Add Seq as per the documentation here. (https://learn.microsoft.com/en-us/dotnet/aspire/logging/seq-integration?tabs=dotnet-cli), try to build the solution.
Expected behavior
The build should be completed successfully.
Additional context
I've workaround this by bringing the source code for Aspire into my solution and commenting out the source code.
Adding this line to the appsetting.config also fixes the issue but is not desired as configuration is being done in code:
I've also logged an issue for awareness on the Aspire Site, any workarounds or thoughts about what the Aspire Code should look like or modification to the NSwag configuration would be appreciated.
The text was updated successfully, but these errors were encountered: