XML Documentation File Not Included in Publish Folder

I selected the " Xml documentation file " in my ASP.NET Core MVC application and displays " bin\Debug\net452\MyProject.xml " as the output folder. The problem is that this file does not exist in the publication folder. Do I need to add additional data to include? Using .NET Core 1.0-RC4 and VS.NET 2017 RC4 (new csproject format).

+7
asp.net-core asp.net-core-mvc visual-studio-2017
source share
4 answers

Apparently this is not implemented in the dotnet publication, but will be in the near future: https://github.com/dotnet/sdk/issues/795

+3
source share

If you use project.json , you can manage the files and folders that are included and excluded during the publishing process:

  "publishOptions": { "include": [ "wwwroot", "appsettings.json", "appsettings.*.json", "web.config" ], "exclude": [ "wwwroot/less" ] } 

For .csproj projects .csproj here is a good resource for replicating old project.json settings in XML, for example:

 <ItemGroup> <Compile Include="..\Shared\*.cs" Exclude="..\Shared\Not\*.cs" /> <EmbeddedResource Include="..\Shared\*.resx" /> <Content Include="Views\**\*" PackagePath="%(Identity)" /> <None Include="some/path/in/project.txt" Pack="true" PackagePath="in/package.txt" /> <None Include="notes.txt" CopyToOutputDirectory="Always" /> <!-- CopyToOutputDirectory = { Always, PreserveNewest, Never } --> <Content Include="files\**\*" CopyToPublishDirectory="PreserveNewest" /> <None Include="publishnotes.txt" CopyToPublishDirectory="Always" /> <!-- CopyToPublishDirectory = { Always, PreserveNewest, Never } --> </ItemGroup> 
+4
source share

The project.json file should have "xmlDoc": true under "buildOptions" :

 { "buildOptions": { "xmlDoc": true } } 

If your code has documentation:

 /// <summary> /// Documentation for FooClass /// </summary> public static class FooClass { // ... } 

Then in your view there should be an xml file that looks like this:

 <doc> <assembly> <name>Foo.Bar</name> </assembly> <members> <member name="T:Foo.Bar.FooClass"> <summary> Documentation for FooClass </summary> </member> </members> </doc> 
+1
source share

Tested on 1.1.2

ResolvedFileToPublish is an element that publishes usage to find out which files should be placed in the publication folder. Include is the source of the file, and RelativePath is inside the publication folder in which the file should be placed. ComputeFilesToPublis h exactly matches its name - it is a Target that collects all the files that will be published.

 <Target Name="CopyDocumentationFile" AfterTargets="ComputeFilesToPublish"> <ItemGroup> <ResolvedFileToPublish Include="@(FinalDocFile)" RelativePath="@(FinalDocFile->'%(Filename)%(Extension)')" /> </ItemGroup> </Target> 

Just add this target to your .csproj and make sure GenerateDocumentationFile set to true

<GenerateDocumentationFile>true</GenerateDocumentationFile>

https://github.com/dotnet/sdk/issues/795#issuecomment-289782712

+1
source share

All Articles