Closed kevingoos closed 4 months ago
Any updates here or is there a preferred workaround?
I created a temporary PostBuildEvent that copies the AssemblyName.xml to dotnet-swagger.xml. The problem is that even though the dotnet swagger tool works and generates the Swagger.json file the naming in the documentation isn't correct in all places.
I also have this problem, when building it in docker it says it can't find the dotnet-swagger.xml
-file
trying to do some copying here as well,
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.
Don't use GetEntryAssembly()
. It would also give you incorrect behaviour in your tests.
Use something like typeof(AClassInYourAssembly).Assembly
.
I am not sure if this is a bug or not, but I didn't get any awnsers on stackoverflow. So that is why I am here looking for a decent awnser...
So I am upgrading my api's from Dotnet 3.1 to Dotnet 5. I setup a test on my build server to check if the swagger documentation is compiling correctly using swagger.exe tofile. But this element is now giving problems.
First I have XML Comments enabled, so that they get included in swagger. I implemented this using the following code, copied from the microsoft documentation.
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, Assembly.GetEntryAssembly()?.GetName().Name + ".xml"));
Now while this all works fine when running the API, when you compile using the swagger CLI to output to a file it crashes (see error below).
But as you can see in the error the EntryAssembly get set to dotnet-swagger.dll. While I could just hardcode it, I am looking for a better solution to fix it. ? Or is this a bug in the .NET 5 version?