Nesting files in Nuget package without PowerShell Nesting files in Nuget package without PowerShell powershell powershell

Nesting files in Nuget package without PowerShell


Packages can add MSBuild items like this to a project by using a .props file in the package. It would contain the same content that you would put into the .csproj file.

The down side of this is that the content cannot be modified by the user. If you need to modify the user's actual project file and copy content to the project folder you would have to include a .targets file in your package and set BeforeTargets="Build" on your target. This would give you a chance to run before build and make changes as needed.

The build folder works for both packages.config and PackageReference (NETCore SDK) projects. You can find more out about it here: https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package