Hi
I am creating a package that have a macro in it. I am trying to create a nuget package of my plugin. I go through the umbraco doc link
and it says that
However if you are bundling up Partial View Macros as part of a package, they can also exist in this folder:
~/App_Plugins/[YourPackageName]/Views/MacroPartials
When i create plugin and place my macro view to ~/Views/MacroPartials path, its workin in case of pluing but i am not able to find ~/App_Plugins/[YourPackageName]/Views/MacroPartials view path in my macro.
How can i make macro as a part of my plugin and nuget package.
When using Umbraco’s own package format you can configure a macro to be created during install, but when you ship the package via nuget you would need to handle this differently.
I think that the best approach is to create a migration that creates the macro using the APIs during the first startup after your fall has been added. Umbraco has a built in concept of Migrations that you can use in your package, I think that there’s some examples in the documentation.
One might think that it would work with a component that just creates the Marco during startup but the migration makes sure that the Marco is only creates once and not gets recreated when if someone removes it or renames it.
How to make macro as a part of nuget package
Hi I am creating a package that have a macro in it. I am trying to create a nuget package of my plugin. I go through the umbraco doc link
and it says that
When i create plugin and place my macro view to ~/Views/MacroPartials path, its workin in case of pluing but i am not able to find ~/App_Plugins/[YourPackageName]/Views/MacroPartials view path in my macro. How can i make macro as a part of my plugin and nuget package.
Hi!
When using Umbraco’s own package format you can configure a macro to be created during install, but when you ship the package via nuget you would need to handle this differently.
I think that the best approach is to create a migration that creates the macro using the APIs during the first startup after your fall has been added. Umbraco has a built in concept of Migrations that you can use in your package, I think that there’s some examples in the documentation.
Hi Markus,
Thanks for reply
Can you please share some link that help to create macro as part of nuget
Thanks
Hi!
Is all in the docs here on our.
You would need to create a custom migration, this one shows how to create db-tables but you can see the concept here: https://our.umbraco.com/documentation/extending/database/
One might think that it would work with a component that just creates the Marco during startup but the migration makes sure that the Marco is only creates once and not gets recreated when if someone removes it or renames it.
And add the Marco: https://our.umbraco.com/documentation/reference/management/services/MacroService/
Good luck! :)
is working on a reply...