question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet publish does not copy the documentation file with csproj

See original GitHub issue

Steps to reproduce

Have a solution with multiple projects The main “web” project has the GenerateDocumentationFile set to true

Expected behavior

When I run dotnet publish of the main “web” project, I expect that the XML documentation file is copied into the publishing folder. (Note the build will generate the file as it should.)

Actual behavior

When I run dotnet publish of the main “web” project, it does not copy the XML documentation file to the psublish folder.

My workaround

My current workaround is to update the csproj of the main web project and manually copy the file:

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
		<ItemGroup>
			<DocFile Include="bin\**\**\PROJECT_XYZ.xml" />
		</ItemGroup>
		<Copy SourceFiles="@(DocFile)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="false"  />
  </Target>

Environment data

.NET Command Line Tools (1.0.0-rc3-004530)

Product Information: Version: 1.0.0-rc3-004530 Commit SHA-1 hash: 0de3338607

Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.0-rc3-004530

This issue has been copied over from https://github.com/dotnet/cli/issues/5562.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:27
  • Comments:54 (27 by maintainers)

github_iconTop GitHub Comments

89reactions
masterjscommented, Feb 3, 2017

Hello @davkean , My project is a big WebAPI netcore and like many API, I’m using Swagger whom needs the XML documentation file if I want to have a good documentation for my API. Also, it use to work when I was using .xproj.

Also, another of my project (solution with multiple projects) has the flag GenerateDocumentationFile turned On and somehow that one is copied over.

So in a nutshell, it use to work and now I see two different things contradicting themselves.

thank you, JS

61reactions
davkeancommented, Feb 3, 2017

@masterjs What’s the expectation around this? Why do you expect the XML file to be published - it’s a dev artefact.

Read more comments on GitHub >

github_iconTop Results From Across the Web

net - dotnet publish include extra files
When you launch dotnet publish command, $(SolutionDir) macros is not defined. As result xcopy is launched with incorrect source path.
Read more >
dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system. Synopsis .NET CLI Copy.
Read more >
Don't lose your swagger with dotnet build
json to csproj, was the <DocumentationFile> no longer automatically copied to the output folder during the build or publish process. There have ...
Read more >
Keeping Content Out of the Publish Folder for WebDeploy
Using .csproj Content Exclusions · CopyToOutputDirectory. Copies files to the Output directory. Note that Output and Publish are different.
Read more >
How to copy dependent assemblies to the bin folder on build?
Open your project file. Simple enough, just select “Edit Project File” by clicking your project using the right mouse button in the Solution ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found