I am creating a project (backend) which is distributed as a NuGet package. The package should add files (js, css, vue, json,...) to the consuming project on installation. This is necessary because the consuming project should be able to work with the files directly.
Both projects are .NET Core (.csproj
).
I tried the following:
- Add files via
content
andcontentFiles
to the package. - Add an
init.ps1
andinstall.ps1
file to the tools folder in the package.
None of the above works.
What's the preferred way to add these files to the project? Is it even possible by installing a NuGet package?
I have seen that it works in the Umbraco CMS via install.ps1
but that's .NET Framework.
Edit: I have tried it now with a *.targets file.
This is the NuGet package content:
(Inspired by the RavenDB.Embedded package)
Problem here is this will only link to the files in the project but not actually copy them to the project on disk.
The generated .nuspec file contains the following items:
<contentFiles>
<files include="any/any/Resources/Countries/countries.de-de.json" buildAction="None" copyToOutput="true" />
<files include="any/any/Resources/Countries/countries.en-us.json" buildAction="None" copyToOutput="true" />
<files include="any/any/Resources/Localization/zero.en-us.json" buildAction="None" copyToOutput="true" />
</contentFiles>
Consuming solution:
Edit 2: I want to reach this goal:
(Taken from here where install.ps1
was used)