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.

No way to include text files in package using dotnet pack command

See original GitHub issue

Steps to reproduce

put the following text in project.json:

“buildOptions”: { “copyToOutput”: [ “MyOwnTextFile.config” ] },

run dotnet pack

Expected behavior

nupkg contains “MyOwnTextFile.config” file

Actual behavior

nupkg does not contain “MyOwnTextFile.config” file

Environment data

dotnet --info output: .NET Command Line Tools (1.0.0-preview2-003121)

Product Information: Version: 1.0.0-preview2-003121 Commit SHA-1 hash: 1e9d529bc5

Runtime Environment: OS Name: Windows OS Version: 6.1.7601 OS Platform: Windows RID: win7-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hardhubcommented, Aug 27, 2016

Nice! Now it has correct place in package.

But how to tell that this file should be placed in project and copied on build to output?

In other words setup “contentFiles”:
https://docs.nuget.org/create/nuspec-reference#contentfiles-with-visual-studio-2015-update-1-and-later

1reaction
giggiocommented, Aug 24, 2016

You should use packOptions, not buildOptions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No way to include text files in package using dotnet pack ...
Now it has correct place in package. But how to tell that this file should be placed in project and copied on build...
Read more >
How do I include a text file alongside my class library in ...
Bar.csproj file with the following content: ... you right click the project and select Pack (or if you run dotnet pack from the...
Read more >
dotnet pack command - .NET CLI
The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a...
Read more >
Dotnet pack - include referenced projects
Shows how to workaround the current limitations of dotnet pack when referencing other projects.
Read more >
Copy NuGet Content Files to Output Directory on Build
After reproducing the issue, I narrowed it down to a problem copying template files to the project output directory on build. Because the...
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