Skip to content
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

XML Comments section is not working as described for ASP.NET Core 1.1 #6686

Closed
Structed opened this issue May 30, 2018 — with docs.microsoft.com · 12 comments
Closed
Assignees
Labels
Pri1 Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

Copy link

Structed commented May 30, 2018

First, the code to enable the loading of the XML file in the Startup.cs is incorrect for ASP.NET Core 1.1. The Correct lines are as follows:

var xmlFile = $"{Assembly.GetEntryAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
setupAction.IncludeXmlComments(xmlPath);

Second, this will not work at all if the app was published. For this, you have to add a Target to the csproj file. See example by @spboyer here: https://github.com/spboyer/copydocfile-example


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@scottaddie scottaddie self-assigned this May 30, 2018
@scottaddie scottaddie added the Source - Docs.ms Docs Customer feedback via GitHub Issue label May 30, 2018
@scottaddie scottaddie added this to the 2018 - Quarter 2 milestone May 30, 2018
@scottaddie scottaddie added the bug label May 31, 2018
@scottaddie
Copy link
Member

@Structed Thank you for pointing this out. You're correct that the GetExecutingAssembly method isn't available until 2.0. I'm working on this now.

scottaddie added a commit that referenced this issue Jun 1, 2018
Addresses #6686 (still need to address deployment concerns)
Addresses #5495

**Changes**
- Update 2.1 sample app from RC1 to RTM
- Simplify sample app download link markup

[Internal Review Page](https://review.docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-1.1&branch=pr-en-us-6761#add-and-configure-swagger-middleware)
Copy link
Author

Structed commented Jun 3, 2018

Thanks, @scottaddie! Please also have a look at the second thing. Since you're describing the use of XML Comments, you should go all the way including that "hack" to add a copy target to the csproj file. I also think, this is still required in ASP.NET Core 2.0?

@scottaddie
Copy link
Member

@Structed I plan to address your point about app publishing in the next week or so. This issue won't be closed until that's completed.

@scottaddie
Copy link
Member

@rynowak Please review Shayne's blog post (linked above). Would you like this publish detail included in the doc?

@rynowak
Copy link
Member

rynowak commented Jun 19, 2018

/cc @vijayrkn - this is publish related - who should review?

@vijayrkn
Copy link

@dsplaisted

@dsplaisted
Copy link
Member

@vijayrkn What am I supposed to review here?

@vijayrkn
Copy link

https://github.com/spboyer/copydocfile-example

Is this the right extensibility for publish?

@dsplaisted
Copy link
Member

The solution in the blog post is no longer needed with newer SDKs. Rather than working around the issue when using an old SDK, I would recommend that people use the latest SDK (they can still target .NET Core 1.x with it).

If we were going to put a workaround in the docs, I would suggest the one here: dotnet/sdk#795 (comment)

@scottaddie
Copy link
Member

@dsplaisted Was this issue fixed in 2.1.300? I'd like to identify the SDK version that's needed.

@dsplaisted
Copy link
Member

@scottaddie According to @dasMulli, it was fixed in 2.0.0, and there was a VB-specific issue with it that was fixed in 2.1.300.

@dasMulli
Copy link

dasMulli commented Jun 25, 2018

You can slim the csproj sample down to

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
  <NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

Reasons:

  1. Property group in the sample is conditioned to debug mode. you don't want that to also support publishing the documentation in release builds.
  2. GenerateDocumentationFile is much nicer. Also, the original sample should have used $(AssemblyName) instead of $(MSBuildProjectName) for correctness.
  3. Only append to NoWarn instead of fully redefining it. This allows to also consume changes such as Removing 1705 from the NoWarn list for CSharp. sdk#1868 where the default NoWarn for c# was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pri1 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

6 participants