https://discord.umbraco.com logo
#package-development
Title
# package-development
m

mattbrailsford

07/08/2022, 8:07 AM
You need to use an MSBuild targets file to perform the copy on build. Unfortunately NuGet doesn't really support the deployment of static assets and so you have to use a funky workaround. You can find an example of a targets file in one of @kevinjump packages here https://github.com/KevinJump/Our.Umbraco.MaintenanceMode/blob/v9/dev/Our.Umbraco.MaintenanceMode/build/Our.Umbraco.MaintenanceMode.targets then copy your assets AND the targets files into your package using something like this in proj file https://github.com/KevinJump/Our.Umbraco.MaintenanceMode/blob/v9/dev/Our.Umbraco.MaintenanceMode/Our.Umbraco.MaintenanceMode.csproj#L37-L46 It's important the targets file ends up in the
buildTransitive
directory though. The newer approach though is to potentially look at Razor Compiled Libraries instead to deploy your assets embedded in a DLL instead. There are still some gotchas with this though with you needing to inject the package manifest via C# code in a composer though as Umbraco doesn't currently have the ability to resolve package manifest files from RCLs (I believe Kevin is working on a PR for that)