I have MVC 4.0 WebApi project with auto generated help based on this.
My model classes are stored it another projects in my solution. Generation of xml file is enabled for every project (Project Properties -> Build -> OutPut -> XML Documentation file - Enabled).
In local debug all is ok - xml files are copied to project directory and i see comments for fields / classes from another projects.
But when i use publish profile (to Folder), xml files don't copy to output folder. Only one xml file from main WebApi project is copied. So i don't see comments to classes from other projects.
I had a similar issue, for the me the answer was a bit of a "doh!" moment.
In the project settings, I had only enabled the XML documentation file under the Debug configuration, and not under Release. I was deploying with Release, and so the XML documentation was not actually getting generated. So the fix was making sure to enable the XML documentation for both Debug and Release configurations.
You can do it by two different way :
1) Go to your project property --> select build option --> check "XML documentation File" --> add path "App_data\XMLDocument.xml" --> save setting, build your project --> include your XMLDocument.xml file --> select property --> copy to output directory --> select "Copy always"
2) Go to your project property --> select "Package/Publish Web" option --> items to displays --> select "all files in this project" from dropdown
I had the same problem, that only the xml file from the webapi project has been deployed.
To fix it, I had to add this to my Web(Api) project file, within the first PropertyGroup
element.
<ExcludeXmlAssemblyFiles>false</ExcludeXmlAssemblyFiles>
After that, the documentation xml-files of all projects (where it's enabled) has been published!
I was able to solve this using just a custom MSBuild target in the publish profile .pubxml
file. Follow the steps below.
The end result is that this MSBuild target will copy all .xml
files from the Web API's bin folder to the bin folder where you are publishing. No need to copy these files to App_Data
.
1) Open the appropriate .pubxml
file from [Project Folder]\Properties\PublishProfiles
.
2) Add this snippet within the <Project><PropertyGroup>
tag:
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForMsdeployDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
3) Add this snippet after the <PropertyGroup>
tag:
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="bin\*.xml" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>bin\%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Credit goes to this answer which was addressing how to include files from outside the project directory when publishing.
Open your publishprofile (*.pubxml) and include this code into "Project" element:
<ItemGroup>
<Content Include="bin\yourDocumentationFile.xml">
<CopyToOutputDirectory>true</CopyToOutputDirectory>
</Content>
<!-- Include a content to each documentation file -->
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With