1

I added the Microsoft.PowerShell.SDK NuGet package to my project and these folders appeared in it.

run

Why does it happen?

thatguy
  • 21,059
  • 6
  • 30
  • 40
Joelty
  • 1,751
  • 5
  • 22
  • 64
  • I agree with `thatguy`. And these files are from the [contentfiles folder](https://learn.microsoft.com/en-us/nuget/reference/nuspec#using-the-contentfiles-element-for-content-files) of the nuget. The goal for it is to import some files into your main project according to the author's need. Also, `contentfiles` folder only works for new sdk project with [PackageReference nuget management format](https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files). – Mr Qian Jul 24 '20 at 08:23
  • When you references these files, they exist in your project in the form of link references, not in your current project, or in the nuget package. Just in the form of a link. Also, there is [a similar issue](https://stackoverflow.com/questions/52110740/nuget-package-for-just-content-files). – Mr Qian Jul 24 '20 at 08:26

1 Answers1

3

NuGet 4.0+ with PackageReference supports content files. Content files are used to include artifacts like text files, XML files, images or even C# or VB code in a package that are are included with a predefined build action into the consuming project, optionally with a specific copy action.

The Microsoft.PowerShell.SDK package defines the content folders ref and runtimes that contain psd1, ps1xml files that are included with build action None in your project. They are copied to the output directory if newer. Visual Studio shows them with that little blue link arrow so that you know that they are referenced and not created in your own project.

Below you see the internal structure of the package. The path of the files inside of the package is given by /contentFiles/{codeLanguage}/{TargetFrameworkMoniker}, where any is like a wildcard.

enter image description here

Note that if you install the Microsoft.PowerShell.SDK package in an older project type that uses packages.config you will not see them, because content files are not supported there.

thatguy
  • 21,059
  • 6
  • 30
  • 40