Open archubbuck opened 2 years ago
@RicoSuter I did come across NSwag.Sample.NET60 but this sample doesn't have API versioning enabled, nor does it have any code generators defined.
Any guidance you can provide would be greatly appreciated. Thank you!
@archubbuck I'm currently developing a project where we are generating clients, but sadly can't share it publicly. Is there anything else you need to know?
MSBuild generation works exactly like it does in this other .NET Core 3.1 sample, but using $(NSwagExe_Net60
and updating the relevant .NET versions in nswag.json
file. No specific api versioning configured, though.
Thank you for your insight, eduherminio.
It looks like the link you've provided is private so I'm unable to access it. I'll continue playing around with the middleware to see if I can get everything to work together nicely and when I do find a solution, I'll be sure to share it here for others to take advantage of as well.
My bad, feel free to try again now @archubbuck.
I can't get this to work either. If i point to the generated swagger json file it works fine but if i try to include it in the msbuild i dont get any errors until it finally throws a "process dotnet timed out".
Well nevermind, it was the nobuild flag. For anyone else having trouble I was able to get a build to work with:
in project file:
<PropertyGroup>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug' ">
<Exec WorkingDirectory="$(ProjectDir)" EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="$(NSwagExe_Net60) run NswagFile.nswag /variables:Configuration=$(Configuration)" />
</Target>
{
"runtime": "Net60",
"defaultVariables": null,
"documentGenerator": {
"aspNetCoreToOpenApi": {
"project": "XXXXX.csproj",
"msBuildProjectExtensionsPath": null,
"configuration": null,
"runtime": "",
"targetFramework": "",
"noBuild": true,
"msBuildOutputPath": null,
"verbose": true,
"workingDirectory": null,
"requireParametersWithoutDefault": false,
"apiGroupNames": null,
"defaultPropertyNameHandling": "Default",
"defaultReferenceTypeNullHandling": "Null",
"defaultDictionaryValueReferenceTypeNullHandling": "NotNull",
"defaultResponseReferenceTypeNullHandling": "NotNull",
"generateOriginalParameterNames": true,
"defaultEnumHandling": "Integer",
"flattenInheritanceHierarchy": false,
"generateKnownTypes": true,
"generateEnumMappingDescription": false,
"generateXmlObjects": false,
"generateAbstractProperties": false,
"generateAbstractSchemas": true,
"ignoreObsoleteProperties": false,
"allowReferencesWithProperties": false,
"useXmlDocumentation": true,
"resolveExternalXmlDocumentation": true,
"excludedTypeNames": [],
"serviceHost": null,
"serviceBasePath": null,
"serviceSchemes": [],
"infoTitle": "My Title",
"infoDescription": null,
"infoVersion": "1.0.0",
"documentTemplate": null,
"documentProcessorTypes": [],
"operationProcessorTypes": [],
"typeNameGeneratorType": null,
"schemaNameGeneratorType": null,
"contractResolverType": null,
"serializerSettingsType": null,
"useDocumentProvider": true,
"documentName": "v1",
"aspNetCoreEnvironment": "Development",
"createWebHostBuilderMethod": null,
"startupType": null,
"allowNullableBodyParameters": true,
"useHttpAttributeNameAsOperationId": false,
"output": null,
"outputType": "Swagger2",
"newLineBehavior": "Auto",
"assemblyPaths": [],
"assemblyConfig": null,
"referencePaths": [],
"useNuGetCache": false
}
},
......OUTPUT OPTIONS
Are there any samples available for .NET 6.0 with clients automatically generated via MSBuild?